Download it now!
Bug 123026 - LibreOffice ignore xlsxwriter 'text_wrap' formatting option, seems optimal height for row is not being set to hold cells with wrapped text
Summary: LibreOffice ignore xlsxwriter 'text_wrap' formatting option, seems optimal he...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
Keywords: needsDevEval
Depends on:
Blocks: Calc-Cells
  Show dependency treegraph
Reported: 2019-01-28 23:42 UTC by Aldennis
Modified: 2020-10-08 08:48 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:

Generated excel file using xlsxwriter (5.98 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2019-01-28 23:49 UTC, Aldennis

Note You need to log in before you can comment on or make changes to this bug.
Description Aldennis 2019-01-28 23:42:43 UTC
I'm creating an excel document using xlsxwriter through python. However, I have a requirement to output the same file and layout in PDF format. I've tried to use the LibreOffice command line option for converting *.xlsx file to PDF but I always end up with an overlapping text. Openning the same file in OpenOffice and Excel 2013 had the row heigt adjusted properly to fit the text.

Steps to Reproduce:
1. Open the attached sample file in LibreOffice, OpenOffice and MS Excel

Actual Results:
The row doesn't resize to fit the text in the cell properly even though 'text_wrap' is enabled in xlsxwriter.

Expected Results:
Row should resize automatically to fit the cell when 'text_wrap' is enabled in xlsxwriter

Reproducible: Always

User Profile Reset: No

OpenGL enabled: Yes

Additional Info:
Someone has already asked this issue in xlsxwriter github page but gets dismissed placing the reason to be software specific:

Already asked this in the LibreOffice forum and suggested to file a bug report
Comment 1 Aldennis 2019-01-28 23:49:34 UTC
Created attachment 148719 [details]
Generated excel file using xlsxwriter

Open the attached file in LibreOffice, OpenOffice and MS Excel.
Comment 2 V Stuart Foote 2019-01-29 06:06:18 UTC
Confirmed on Windows 10 Pro 64-bit en-US with
Version: (x64)
Build ID: 9d0f32d1f0b509096fd65e0d4bec26ddd1938fd3
CPU threads: 8; OS: Windows 10.0; UI render: GL; 
Locale: en-US (en_US); Calc: group threaded

and current master/6.3.0

But actually, the filter import to Calc *does* set the cell formatting to "Wrap text automatically". An uncheck and check of the value will expand the row wrapping the text. 

As will Clearing direct formatting, with an immediate undo.

Applying a Format -> Row -> Optimal height or 0.0 will also expand.

So unclear what is preventing the cell height from expanding to hold the wrap upon import, but the wrap attribute is being set. Just not displayed after import.

Saving to ODF format, both .ODS and flat .FODS, is read back in with row expanded to hold wrapped text.
Comment 3 V Stuart Foote 2019-01-29 17:40:37 UTC
So isn't this more an issue of the optimal height, for rows holding cells with wrapped text, not being applied on initial view?

Seems a long standing issue judging from the see also of bug 32950 bug 55433 and bug 62361, but not sure I'd call it a dupe just yet.
Comment 4 V Stuart Foote 2019-01-29 20:53:29 UTC
Correcting bug 62268 [1] looks to maintain performance by not recalculating height of all rows, but just when parsing of ODF spreadsheets with row styling "use-optimal-row-height" set true.

Guess that means for some externally generated XML, the XlsxWriter output here, there is no style "use-optimal-row-height" being set in the import filter--so the row height is locked at some default row height even though the text wrap is enabled.

Can the import filter(s) be adjusted to set the use-optimal-row-height style on rows when just the wrap text cell is encountered in a cell? That seems to be the way Excel 2007+ consumed the XML--no row height.

Or, should handling output of the XlsxWriter generator be NOB? It does clear as soon as we export to an ODF styled format, or modify the imported sheet.