Bug 97656 - Hyperlink Paste Failure
Summary: Hyperlink Paste Failure
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: preBibisect, regression
Depends on:
Blocks: RTF Paste
  Show dependency treegraph
Reported: 2016-02-08 19:54 UTC by bugs
Modified: 2023-11-30 03:16 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:

In Wordpad in Windows 10 after running program and hitting paste special (105.00 KB, image/jpeg)
2016-05-08 05:06 UTC, bugs
After Pasting the RTF (92.96 KB, image/jpeg)
2016-05-08 05:07 UTC, bugs
After Pasting the Plain Text (94.99 KB, image/jpeg)
2016-05-08 05:07 UTC, bugs

Note You need to log in before you can comment on or make changes to this bug.
Description bugs 2016-02-08 19:54:25 UTC
Up until Libre Office 5 (unknown which subversion), the Pasting of a simple Hyperlink worked correctly, in that both the Text and the Hyperlink were pasted into the document. If I paste the following RTF, only the text is pasted:

{\colortbl ;\red0\green0\blue255;}
\uc1\pard\lang6153{\field{\*\fldinst{HYPERLINK "GP-65797" }}{\fldrslt{\cf1 <Given Name>}}}}

This RTF is created by an external program using an AddOn to communicate to Libre Office. A different AddIn is used to communicate with Microsoft Word. The same RTF worked for Microsoft Word, Wordpad and Libre Office and some other editors.
Comment 1 bugs 2016-02-09 09:09:43 UTC
I wrote a program to save the RTF that swriter places on the Clipboard. I then cleared the clipboard and placed the exact same RTF on the Clipboard and pasted it into swriter it only pasted the Format textm no hyperlink.
If I paste into WordPad the hyperlink is correct.
Also if I pasted a hyperlink from MSWord (Linked to GP-2323) it converts it to a hyperlink for the form http://GP-2323
Comment 2 raal 2016-02-10 10:55:59 UTC
how to reproduce this? Please write the steps how to reproduce the bug.
Comment 3 bugs 2016-02-10 12:30:55 UTC
The problem with demonstrating this is that Microsoft Word when copying a Hyperlink, also copies it as HTML Format, thus swriter uses the HTML instead of the RTF. The program below will copy just RTF (and Text) to the clipboard. Run the program and paste into WordPad and swriter. It works in Wordpad, (MS Word) but not swriter.

#include <windows.h>

int main(int argc,char *argv[]) {

int Fmt,Len;
char *Str,*lptstrCopy;
HGLOBAL hglbCopy;

	Fmt = RegisterClipboardFormat("Rich Text Format");
	Str="{\\rtf1 {\\field{\\*\\fldinst{HYPERLINK \"GP-1234\" }}{\\fldrslt{\\cf1 <Link Name>}}}}";
	hglbCopy = GlobalAlloc(GMEM_MOVEABLE,Len);
    lptstrCopy = GlobalLock(hglbCopy); 
	memcpy(lptstrCopy, Str, Len);
    SetClipboardData(Fmt, hglbCopy); 

	Str="Copy This Text as Text into Clipboard";
	hglbCopy = GlobalAlloc(GMEM_MOVEABLE,Len);
    lptstrCopy = GlobalLock(hglbCopy); 
	memcpy(lptstrCopy, Str, Len);
    SetClipboardData(CF_TEXT, hglbCopy); 
Comment 4 Aron Budea 2016-05-08 02:48:21 UTC
I'm trying to reproduce the bug, and am running into some issues with the reproduction steps. I compiled and ran the program, and it indeed copied "Copy This Text as Text into Clipboard" to clipboard.
However, pasting it even into WordPad (Windows 7) only produces text, and not hyperlink.

Also, is the first sentence in the initial report supposed to mean that it used to work in previous LibreOffice versions (4.x or so) as you'd expect?
Comment 5 bugs 2016-05-08 05:06:38 UTC
Created attachment 124904 [details]
In Wordpad in Windows 10 after running program and hitting paste special
Comment 6 bugs 2016-05-08 05:07:06 UTC
Created attachment 124905 [details]
After Pasting the RTF
Comment 7 bugs 2016-05-08 05:07:36 UTC
Created attachment 124906 [details]
After Pasting the Plain Text
Comment 8 bugs 2016-05-08 05:10:37 UTC
This used to work in ALL Office (Both Libre and Open) versions before 5.x.

As to why this may not have worked for you, I don't know. Just make sure you are compiling as an ASCII program (not UNICODE) and running WordPad not Notepad. Try it in older Office versions or Microsoft Word.
Comment 9 Aron Budea 2016-05-08 23:10:29 UTC
Ah, I didn't compile it as ASCII, that was the problem, thanks for the clarification. After compiling correctly, and running the program, I can see the pasted text as link in WordPad.

Here is my analysis:
v3.6.0.4: "<Link Name>" is pasted, and it is a link,
v4.0.0.3 - v5.1.2.2 (tested with some major versions): "<Link Name>" is pasted, but it's not a link,
development master build: "Copy This Text as Text into Clipboard" is pasted, and it's not a link.

I conclude that the issue is reproducible, though the last working version seems to be 3.6.
If you want to verify whether it indeed worked in 4.x versions, "Regression Testing" on the following page has information on installing different versions of LO in parallel, and link to old releases: https://wiki.documentfoundation.org/QA/Triage_For_Beginners
Comment 10 Xisco Faulí 2016-09-13 14:30:54 UTC
As per today, this regression can't be bibisected as it was introduced before 4.4 branch and there's no bibisect repository for the affected branch for windows, thus change 'bibisectRequest' to 'preBibisect'.
Comment 11 Xisco Faulí 2016-09-19 15:29:47 UTC Comment hidden (obsolete)
Comment 12 QA Administrators 2018-04-28 02:31:44 UTC Comment hidden (obsolete)
Comment 13 jnthomps 2018-11-28 11:12:03 UTC
This still appears to be an issue.  

I cut text that contains a hyperlink and the hyperlink doesn't make it into Writer when I paste it.  I have tried cutting from several other programs: Notes, Pages, TextEdit; same result.

Here's the info on my setup from Help - About LibreOffice.

Build ID: 0c292870b25a325b5ed35f6b45599d2ea4458e77
CPU threads: 4; OS: Mac OS X 10.14.1; UI render: GL; 
Locale: en-US (en_US.UTF-8); Calc: group

Thanks for offering this great software...

Feel free to contact me - jnthomps@gmail.com
Comment 14 QA Administrators 2019-11-29 03:45:07 UTC Comment hidden (obsolete)
Comment 15 QA Administrators 2021-11-29 04:36:08 UTC Comment hidden (obsolete, spam)
Comment 16 QA Administrators 2023-11-30 03:16:46 UTC
Dear bugs,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)

If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword

Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team