Bug 117926 - FILESAVE: XLSX: Sheets name shouldn't exceed 31 characters
Summary: FILESAVE: XLSX: Sheets name shouldn't exceed 31 characters
Status: RESOLVED DUPLICATE of bug 79998
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
: 117606 (view as bug list)
Depends on:
Blocks: XLSX Sheet-Tabs-Bar
  Show dependency treegraph
Reported: 2018-05-31 09:06 UTC by Xisco Faulí
Modified: 2020-06-29 13:38 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:

sample file with 32 characters in sheet name (4.27 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2018-05-31 09:06 UTC, Xisco Faulí
Possible design of file checker design - from MS office (131.83 KB, image/png)
2018-05-31 11:50 UTC, sverre48

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2018-05-31 09:06:19 UTC
Created attachment 142433 [details]
sample file with 32 characters in sheet name

Steps to reproduce:
1. Open the attached file in MSO Excel
-> Excel complains about unreadable content.

If we edit the document in LibreOffice and we remove the last 'd' from the sheet name, it's open correctly in Excel.

Limitation: https://support.office.com/en-us/article/Rename-a-worksheet-3F1F7148-EE83-404D-8EF0-9FF99FBAD1F9

If the file is saved to .XLS, Excel doesn't complain and only the first 31 characters are used.

Excel limits the number of characters to 31 when editing the name

Reproduced in

Build ID: 2a0d8106a558845357d39648656e08ec6f091cf8
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group threaded
Comment 1 Xisco Faulí 2018-05-31 09:08:37 UTC
*** Bug 117606 has been marked as a duplicate of this bug. ***
Comment 2 Xisco Faulí 2018-05-31 09:09:57 UTC
@Regina, @Eike, Do you have any opinion here? Should we limit the sheet name to 31 to avoid incompatibility issues?
Comment 3 Eike Rathke 2018-05-31 10:10:09 UTC
Artificially limiting doesn't make much sense, though we could limit to 31 characters when manually renaming a sheet.

ODF doesn't limit the length, so any file opened as ODF and saved as Excel could suffer the same. Also importing CSV creates a sheet name from the file name, which may be longer. When saving to Excel maybe the name could be truncated, but care would have to be taken that no duplicate names would be created that way. Writing references all would have to use an extra mapping, also structures and functions using sheet names as literal strings like INDIRECT() addressing would then break. I'd avoid fiddling with sheet names when exporting.

We should rather warn or even refuse to save the file in alien formats that are known to have this limit, so the user can rename the sheet as appropriate.
Comment 4 sverre48 2018-05-31 10:40:38 UTC
I approve any solution that warns or disallow renaming sheet names > MAX chars, e.g. by set the max sheet char field length to this same limit in "edit"/rename mode to avoid any such "user" problems. 

It would also be a good idea to issue a save file warning when saving file in MS office supported primary formats like .xlsx - as it is more or less impossible to know what is repaired or removed from file (here sheet names are truncated). Or even better to introduce some general compatibility function that includes several known problems/checks with other office products - as it seems to be hard for users to know what is repaired or broken - when compatibility issues are encountered.

By using a general compatibility or sanity check it lets the users themselves control what do do - instead of seeing a warning on every save (which some users may do not approve).
Comment 5 sverre48 2018-05-31 11:50:11 UTC
Created attachment 142440 [details]
Possible design of file checker design - from MS office

I attach design of how files could be checked in the office family (word, excel, etc). Sorry about the native language. It is just an illustration how such a sanity report could be designed as an alternative to implementing warnings to say the save/save as functions suggested
Comment 6 Thomas Lendo 2018-06-15 23:11:33 UTC
Setting this bug to NEW according to Eike's suggestion in the last paragraph of comment 3.

To avoid problems with renaming procedures, functions and references a warning would be the easiest solution when the user tries to save the file in formats that have a length limitation of sheet names.

sverre48, we should keep this bug as short and focused as possible. Therefore any ideas for checking a file (structure) should be handled in another bug. It's highly possible that there is already an existing one.
Comment 7 QA Administrators 2019-06-16 02:57:22 UTC Comment hidden (obsolete)
Comment 8 NISZ LibreOffice Team 2020-06-29 13:38:33 UTC
This looks like a duplicate.

*** This bug has been marked as a duplicate of bug 79998 ***