Bug 156611 - Calc: able to insert multiple hyperlinks into cell, but they wont be saved
Summary: Calc: able to insert multiple hyperlinks into cell, but they wont be saved
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Attila Szűcs
URL:
Whiteboard: target:24.2.0
Keywords:
Depends on:
Blocks: Hyperlink-Calc
  Show dependency treegraph
 
Reported: 2023-08-04 14:42 UTC by Attila Szűcs
Modified: 2024-02-29 06:41 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Attila Szűcs 2023-08-04 14:42:42 UTC
Description:
MS document formats (xlsx/xls) can store only 1 hyperlink for a cell.
Calc allow us to create more hyperlinks in 1 cell but it can be missleading, because if we save/repoen the xlsx, then those links will be disappear.

An interoperability option could be useful to restrict this behaviour, so we wont lose hyperlinks, upon saving.
If checked: we should be able to insert links like in Excel.. (any hyperlink that is inserted, should be inserted to the whole cell, not for the selected text in the cell)

Steps to Reproduce:
1.open any .xlsx
2.write two words in a cell like: "aaa bbb"
3.insert a link for the first word
4.insert a link for the second word
5.save / reopen

Actual Results:
there is no hyperlink... (both are lost)

Expected Results:
if link insertion would insert link into the whole cell, we would see right at the 2. link insertion, that we overwrite the 1. link with the 2.
And after save/reopen, we would still see the 2. hyperlink


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.6.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 0a90b90048313fb43f8c5d7461f58dafec276600
CPU threads: 6; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: CL threaded
Comment 1 Eike Rathke 2023-08-04 15:33:01 UTC
Wouldn't Excel complain if there is more than one hyperlink per cell, or how does it behave when loading such (manipulated) document? Furthermore, the file format seems to turn the entire cell into a hyperlink, so preserving two individually assigned URLs may not be possible or at least could be complicated (the <hyperlink> element's display attribute string could be used to match, which it currently also isn't just using the entire cell content).

Anyway, first check what Excel does with

  <hyperlinks>
    <hyperlink ref="A1" location="B2" display="bbb"/>
    <hyperlink ref="A1" location="C3" display="ccc"/>
  </hyperlinks>

and

  <si>
    <r>
      <rPr>
        <sz val="10"/>
        <color rgb="FF0000FF"/>
        <rFont val="Arial"/>
        <family val="2"/>
        <charset val="1"/>
      </rPr>
      <t xml:space="preserve">bbb</t>
    </r>
    <r>
      <rPr>
        <sz val="10"/>
        <rFont val="Arial"/>
        <family val="2"/>
        <charset val="1"/>
      </rPr>
      <t xml:space="preserve"> </t>
    </r>
    <r>
      <rPr>
        <sz val="10"/>
        <color rgb="FF0000FF"/>
        <rFont val="Arial"/>
        <family val="2"/>
        <charset val="1"/>
      </rPr>
      <t xml:space="preserve">ccc</t>
    </r>
  </si>
Comment 2 Attila Szűcs 2023-08-04 15:51:06 UTC
Calc not save multiple hyperlinks into xlsx... only 1/cell

I made a gerrit with a new option:
https://gerrit.libreoffice.org/c/core/+/155079

Tools -> Options -> LibreOfficeDev Calc -> Compatibility -> Hyperlinks
if this option is set, and MS fileformat is used, then, when we insert a hyperlink it will work like if the whole cell was selected for hyperlink insertion... just like at excel.

That way only 1 hyperlink will able te exist in 1 cell, so it will be compatible with excel.
Comment 3 Gabor Kelemen (allotropia) 2023-08-04 19:17:38 UTC
This is pretty much duplicate of bug 149076 and the older ones in its See also.
Comment 4 Caolán McNamara 2023-08-17 12:21:12 UTC
I think this can be summarized as an application-side compatibility option to behave like Excel wrt putting hyperlinks in cells. And it defaults to off unless explicitly enabled.
Comment 5 Commit Notification 2023-08-23 13:23:43 UTC
Attila Szűcs committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/24cd55341bc3f3e8ed9d5ff23efd47a53532f283

tdf#156611 SC: hyperlink option for MS behaviour

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2023-08-28 15:07:49 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b7d5b8cee77e4cfd931cdbd6f4ba8673c6bbe490

Related: tdf#156611 move long explanation string into tooltip

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Stéphane Guillou (stragu) 2024-02-29 06:41:59 UTC
Can this be closed as fixed? I can add it to the release notes too.