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.
Code pointer: https://opengrok.libreoffice.org/xref/core/sc/source/filter/excel/xecontent.cxx?r=9f1701d0#407
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).
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.
(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.
(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".
... and for XLS 97-2003, the actual limit (after which silent loss of hyperlink happens at save) is weird 1987 characters (1988 is lost).
And finally: for XLS 5.0-95, I couldn't persuade Excel 2016 to save even a short URL like https://example.org/.