Bug 151031

Summary: FILESAVE XLS->ODS: use-optimal-row-height wrong on first save
Product: LibreOffice Reporter: Justin L <jluth>
Component: CalcAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: normal CC: jluth, kelemeng, miguelangelrv
Priority: medium Keywords: filter:ods, filter:xls
Version: Inherited From OOo   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 88174, 108198    
Attachments: wrapOptimal.xls: optimal height is enabled and functional

Description Justin L 2022-09-17 14:05:04 UTC
Created attachment 182523 [details]
wrapOptimal.xls: optimal height is enabled and functional

This document has optimal height enabled for row 1. It works too. (Can be confirmed by adding extra text and watching the height increase.) However, when saving to ODS format, the first save lists autostyle ro1 as use-optimal-row-height = false. (A second save immediately afterwards correctly sets = true.)

This is only seen on an immediate round-trip. If you make any change to row 1, then it will get the autostyle correctly.

I thought perhaps that running ScDocRowHeightUpdater::updateAll() might avoid this problem, but it doesn't.

For some reason, the same thing is not true for XLSX import.

True in master, and in 5.1, and in 3.6. Assuming inherited from OOo

Steps to reproduce
1.) open wrapOptimal.xls
2.) save as ODT format.
3.) reload ODT - add content to A1 and notice that the cell height doesn't grow.
Comment 1 m_a_riosv 2022-09-17 23:41:51 UTC

*** This bug has been marked as a duplicate of bug 130383 ***
Comment 2 Gabor Kelemen (allotropia) 2024-01-17 14:57:02 UTC
I set the bug  130383 to fixed, but this one can still be reproduced.
Even worse than reported: a second save does not fix the issue.

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 25276df12abd9d002f7f899900434617b256f745
CPU threads: 15; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: de-DE (hu_HU); UI: de-DE
Calc: threaded
Comment 3 Justin L 2024-04-20 13:00:57 UTC
(In reply to Gabor Kelemen (allotropia) from comment #2)
> Even worse than reported: a second save does not fix the issue.
Second save still works for me in today's 24.8.

Let me clarify my steps.
1.) open wrapOptimal.xls
2a.) save as wrapOptimalRT1.ods
2b.) (and then immediately) save as wrapOptimalRT2.ods
3a.) reload RT1 - new content doesn't expand the cell height.
3b.) reload RT2 - new content does expand the cell height
Comment 4 Justin L 2024-04-20 18:53:00 UTC
commit e623ee66dfde0d5a2705e222aaa7ce580e409506
Author: Noel Power on Tue May 22 10:08:26 2012 +0100
    make row heights ( incl default row height ) from excel are saved absolute

QUOTE: "Currently default row heights imported from Excel are not adjusted Optimally ( AdjustRowHeight() is no longer called ) However to ensure correct round tripping the CR_MANUALSIZE flag *is* still set, this results in the style:use-optimal-row-height="true" being set for default row height(s) when saving as odf. So, for example absolute positions which are calculated on importing the Excel document ( where the row height is *not* optimally adjusted ) are still saved with the 'style:use-optimal-row-height' set. When the row heights are read back into calc the row sizes are changed any absolutely positioned objects are now out of place. This patch ensures *all* row heights are from an imported excel document are saved with style:use-optimal-row-height="false" "


This has aXMLScFromXLSRowStylesProperties force optimal-row-height to be false with XML_TYPE_BOOL_FALSE, since it isAlienExcelDoc.

Since this is very intentional, and the explanation is complete gobbledygook, I'm walking away...