I have a problem with a long hyperlink value. When I save the document as .xslx format, the hyperlink is being truncated to 256 characters. Microsoft Excel has a limitation of 256 characters in HYPERLINK function but not in hyperlink property of a cell. When I create and save a file with long links directly in Microsoft Excel, the long links are not truncated.
I tried the workaround I found in this site with HYPERLINK(“URL” [; “CellText”]) and it’s not truncated, but Microsoft Excel cannot open it and says the file is corrupted. After fixing Excel cleans the hyperlink formula.
Microsoft Excel has a limitation on HYPERLINK function, but not on the hyperlink property of a cell. So while saving to .xlsx format, Libre Office Calc is doing the opposite of what is needed:
Expected result: hyperlink property of a cell is not truncated to 256 characters; url in HYPERLINK function is truncated to 256 characters
Actual result: hyperlink property of a cell is truncated; HYPERLINK function is not truncated
My Libre Office version is Version: 24.2.4.2 (X86_64) / LibreOffice Community
Link resaved.xlsx (5.9 KB)
Link original.ods (9.5 KB)
I open your Link resaved.xlsx
file in Excel 2016.
In the context menu of cell A1, I select change hyperlink.
The dialog does not allow adding more than 1 character to the address.
The code that truncates the hyperlink appeared without any explanation in 2002, in a commit named simply “code review and documentation”.
I can’t confirm. I even change the relation manually in the XLSX package, and put the full hyperlink there; I confirm that Excel (also 2016!) opens and uses the full URL (clicking goes to the correct address); that I can add arbitrarily more*
characters in the Edit dialog:
and that even saving to XLS (!) from Excel retains all the characters in the hyperlink.
*
EDIT: not arbitrarily more, it turns out. The actual limit, which is both imposed in the dialog, and also causes errors when importing XLSX where the limit is exceeded, is 8192 characters in the URL.
EDIT 2: heh, I really had an impression I investigated it at some point before. It was tdf#150229 (and I found the exact same code; but I didn’t check XLSX limit there, for a reason; it has discussion for different XLS versions, though).
This may be related to Windows settings.
My situation: the length of the current field is 255 characters. The dialog allows adding only 1 character, but after exiting the dialog, the link length is still 255.
In Excel 2019 is not truncating. Even if in Excel 2016 it works differently, Microsoft announced end of support for Office 2016 and Office 2019 on October 14, 2025. Perhaps future versions of LibreOffice should not truncate the hyperlink property. I understand a reasonable limit of ~ 2000 characters, which is close to the default URL length of most web servers (2048), but 256 characters for a hyperlink is insufficient for modern needs.
I agree that the 255 character limit on the hyperlink length when saving a LibreOffice document in MS Excel formats can be revised.
As for the HYPERLINK function, apart from a warning about the possible loss of functionality when saving in a “foreign format”, there is hardly anything that can be done.
@sokol92 yes there’s something very odd with their dialog. It is unstable and inconsistent. It worked unpredictably; if you read my old comments in the bug, I mentioned some 1987-character limit (it obviously misbehaved above that then) - now I can’t repro that …
and I tried with a long URL from scratch - the dialog fails. But I edited the XML, and voila - the file opens, and Excel works with that (please experiment with the two attachments in the bug I just added). For the binary XLS, it’s even more fun: the dialog allows one (only one) more character, but then doesn’t close claiming too many characters (so there’s a mismatch somewhere in their code).
But this is not a place to discuss Excel bugs. Let me just fix our bug now.
Thank you so much! Do you have any information when this fix could be released?