Bug 150229 - Links in cells truncated when saved/re-opened (XLSX format)
Summary: Links in cells truncated when saved/re-opened (XLSX format)
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.3.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:xlsx
Depends on:
Blocks: XLSX-Hyperlink
  Show dependency treegraph
 
Reported: 2022-08-01 21:41 UTC by jjgurley
Modified: 2023-09-07 19:31 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Simple test case (5.99 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2022-08-01 21:41 UTC, jjgurley
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jjgurley 2022-08-01 21:41:19 UTC
Created attachment 181540 [details]
Simple test case

If you create a rather long link (I happen to be creating multiple destination routes in Google Maps and add them to a cell (via CTRL+K), they work as expected until you save and re-open the file as XLSX.  It works properly if you use ODS.

For example, if a link is 300 characters, it gets truncated to 'about' 256 characters.  I get variable lengths, but always in the 256 ballpark, so there's probably something to do with the specific string contents.

I've attached a two cell sheet.  Just copy the link contained in A1 using CTRL+K after selecting A2.  Close, re-open, voila.

1) open LINKS.XLSX
2) select cell A1, hit CTRL+C
3) select cell A2, highlight "LINKS"
4) hit CTRL+K, hit CTRL+V, close
5) CTRL+leftclick to go to link in browser
6) Save/Close/reopen and try #5 again.
Comment 2 Eike Rathke 2022-08-03 21:57:12 UTC
All those XclExpString instances that truncate to 255 probably need to distinguish between BIFF and OOXML export and truncate only for BIFF. Just guessing, untested. (if OOXML actually allows longer strings in that context).
Comment 3 jjgurley 2022-08-03 22:30:45 UTC
There is a work-around:

In the provided example

a2 = hyperlink(a1;"text")

allows an offsheet or hidden cell to contain the link in plain text, which doesn't get truncated.
Comment 4 Mike Kaganski 2022-08-04 05:29:59 UTC
(In reply to Eike Rathke from comment #2)

I can't tell if this is applicable (or if my test shows Excel storing those strings in a different internal structure, and thus comparing apples to oranges?), but MS Excel 2016 allows storing that long URLs also in XLS. So at least in this case, a *possible* fix could be to just increase the limit for all uses.
Comment 5 Mike Kaganski 2022-08-04 06:09:58 UTC
(In reply to Mike Kaganski from comment #4)

On the other hand: I tried to *create* such a link in Excel manually. I created an artificial URL of 2 700 000 characters (hoping that it would either show "there's no practical limit", or cut it down to an acceptable limit), and pasted into Excel's Ctrl+K hyperlink dialog.

The result was "The address for this hyperlink exceeds the 255-character limit. Please reduce the number of characters."

The message is indeed misleading, likely showing that Excel had such a limit at some point (95?), and didn't update error messages since increasing it. And the actual limit seems to be strange 2083 characters in the URL (it starts to show that dialog at 2084 characters).

Note that the testing was done with the default-created new Excel document, not with an XLS (legacy format), where some additional limitations could apply, nor with any "compatibility mode".
Comment 6 Mike Kaganski 2022-08-04 06:25:11 UTC
... and for XLS 97-2003, the actual limit (after which silent loss of hyperlink happens at save) is weird 1987 characters (1988 is lost).
Comment 7 Mike Kaganski 2022-08-04 06:30:40 UTC
And finally: for XLS 5.0-95, I couldn't persuade Excel 2016 to save even a short URL like https://example.org/.