Bug 97106 - FORMATTING: Calc wrap text setting in Cell Formatting not saved in XLS
Summary: FORMATTING: Calc wrap text setting in Cell Formatting not saved in XLS
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: filter:xls, filter:xlsx
: 124117 159615 (view as bug list)
Depends on:
Blocks: Anchor-and-Text-Wrap XLS-Limitations Calc-Cells
  Show dependency treegraph
Reported: 2016-01-13 18:35 UTC by mez.pahlan
Modified: 2024-02-08 15:18 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:

Example spreadsheet (6.00 KB, application/vnd.ms-excel)
2016-01-13 18:35 UTC, mez.pahlan

Note You need to log in before you can comment on or make changes to this bug.
Description mez.pahlan 2016-01-13 18:35:46 UTC
Created attachment 121905 [details]
Example spreadsheet

NB: Originally reported to Ubuntu bug tracker but was asked to post it upstream. https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1412448

When editing an XLS in Libreoffice Calc, the wrap text automatically setting in the cell formatting is not persisted across saves. Attached is a test spreadsheet with a long string of text in cell A1.

Steps to reproduce:
1) Right click cell and go to Format Cells
2) Select Alignment tab
3) Unselect Wrap Text Automatically
4) Press OK
5) Save spreadsheet selecting to keep the XLS format if asked
6) Close spreadsheet
7) Reopen spreadsheet

Expected Result:
When the spreadsheet is reopened cell A1 has remembered that the text is NOT to be wrapped.

Actual Result:
Cell A1 is once again wrapped
Comment 1 Cor Nouws 2016-01-13 19:13:01 UTC
Thanks for filing, mez.pahlan.
I confirm the problem.
But it's not wrapping per see that is forgotten, I think.

It looks related to the issues
bug 34717, and bug 32950
Especially the latter looks suspicious. Could it be the same?

Ciao - Cor
Comment 2 mez.pahlan 2016-01-13 19:58:56 UTC
Hi Cor

No problem.

Bug 32950 certainly looks very related. I'm afraid I don't know enough about that bug or the code to say for sure. But on first glance it does.
Comment 3 QA Administrators 2017-05-22 13:19:50 UTC Comment hidden (obsolete)
Comment 4 mez.pahlan 2017-05-24 20:14:56 UTC
Still present

Ubuntu 17.04

Build ID: 1:5.3.3~rc2-0ubuntu0.17.04.1~lo0
CPU Threads: 4; OS Version: Linux 4.10; UI Render: default; VCL: gtk3; Layout Engine: new; 
Locale: en-GB (en_GB.UTF-8); Calc: group
Comment 5 QA Administrators 2018-05-25 02:43:20 UTC Comment hidden (obsolete)
Comment 6 mirh 2020-05-23 16:08:13 UTC
Still a problem in 6.3.6.
Comment 7 QA Administrators 2022-05-24 03:33:50 UTC Comment hidden (obsolete)
Comment 8 Stéphane Guillou (stragu) 2024-01-24 08:50:40 UTC
Reproduced in OOo 3.3 -> inherited.
And in recent trunk build:

Version: (X86_64) / LibreOffice Community
Build ID: 6d71c21890c908225945f0fc3566255ed150f660
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 9 Stéphane Guillou (stragu) 2024-01-25 04:27:08 UTC
*** Bug 124117 has been marked as a duplicate of this bug. ***
Comment 10 ady 2024-02-08 10:38:30 UTC
*** Bug 159615 has been marked as a duplicate of this bug. ***
Comment 11 Rafael Lima 2024-02-08 12:05:16 UTC
For the record, this problem doesn't seem to happen with newly created XLS and XLSX files.

I created an Excel XLSX file (using MS Excel). In cell A1 I entered a long line of text and wrapped it.

Then I saved the file and reopened in LO Calc. The wrapping was there, as expected. So I opened the Format Cells dialog and unchecked "Wrap text automatically". The text unwrapped as expected.

Then I saved the file and reopened it in LO Calc and the cell was not wrapped (as expected). Then I did the same to enable wrapping again, saved and closed the file. The wrapping was remembered.

Doing the exact same steps with XLS file also worked fine.

However, the issue persists with attachment 121905 [details] provided by the OP. Wrapping settings are not remembered. How can this bug be specific to this file?
Comment 12 ady 2024-02-08 15:18:57 UTC
(In reply to Rafael Lima from comment #11)
> However, the issue persists with attachment 121905 [details] provided by the
> OP. Wrapping settings are not remembered. How can this bug be specific to
> this file?

FWIW, with a recent LO 24.8 alpha, after I open and save attachment 121905 [details], when I want to close the file there is a question whether I want to save the changes.

There is something (at least) strange with this file, as there should not be any additional question after I just saved and want to close it.

With the same attachment 121905 [details], if I remove Wrap Text and save, the cell is automatically set (back) as Wrap Text as soon as I save.

So, this reflects the STR from comment 0.

Now I edit the content of cell A1, to remove the line breaks in the text.

At this point I can save the file as expected.

CONCLUSION based on attachment 121905 [details]:

The cell attribute "Wrap Text" seems to be automatically set when there are manual line breaks within the text of the cell, and the attribute cannot be set OFF, unless removing the manual line breaks. > BUG!

Having said that, the Wrap Text problem is not just with this file.

Another example for the Wrap Text issue: from dupe tdf#159615 comment 8, attachment 192461 [details] can also repro the problem (but there is no question to re-save). Open with LO, set wrap text to cell C2 (which contains a formula resulting in long text), save as xlsx and reload > the cell is not wrapped.

But, on the same attachment 192461 [details], taking an inactive cell and adding simple (long) text (not a formula) with wrap, it is correctly saved and re-opened for that cell (but not for cell C2).

CONCLUSION based on attachment 192461 [details]:
Problem on cells with formulas, but not with simple text. > BUG!

Whether tdf#159615 and other current dupes should be de-duped, IDK.