sc/qa/unit/subsequent_export_test2.cxx | 4 ++++ sc/source/filter/excel/xetable.cxx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
New commits: commit 507c6fc66cda7c1022008b3d1d4c087540cb2d18 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Mon Nov 25 09:58:45 2024 -0500 Commit: Justin Luth <justin.l...@collabora.com> CommitDate: Mon Nov 25 20:45:27 2024 +0100 tdf#124741 export xlsx: no defaultRowHeight without customHeight Apparently, the value of defaultRowHeight is just some nice kind of suggestion to Excel, since optimalRowHeight rows can be less than what is specified in defaultRowHeight. Since Calc always treats defaultRowHeight as authoritative, on export it needs to always export it that way. Apparently there are some TWIPS calculations going on because while Calc defaults to exporting a defaultRowHeight of 12.80, Excel is still round-tripping it as 12.75. make CppunitTest_sc_subsequent_export_test2 \ CPPUNIT_TEST_NAME=testTdf120168 (In this unit test, it originates as customHeight=1, but Calc was round-tripping it without that. Although the round-trip looked identical in Calc, in Excel the empty rows were now much shorter, being height-formatted according to the default font size.) Change-Id: I7ed6b612de0fa508a89dc4cf357b873de230962c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177276 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index decbf2ad00b2..ca0effbea1e1 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -243,6 +243,10 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf120168) // - Actual : general assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", "horizontal", u"left"); assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment", "horizontal", u"right"); + + // tdf#124741: without round-tripping customHeight, Excel wasn't applying defaultRowHeight + xmlDocUniquePtr pSheet = parseExport(u"xl/worksheets/sheet1.xml"_ustr); + assertXPath(pSheet, "//x:sheetFormatPr", "customHeight", u"true"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf117266) diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index a466bfa7ca81..0b287c404871 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2828,10 +2828,10 @@ void XclExpCellTable::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->startElement( XML_sheetFormatPr, // OOXTODO: XML_baseColWidth XML_defaultColWidth, OString::number(maColInfoBfr.GetDefColWidth()), - // OOXTODO: XML_customHeight // OOXTODO: XML_thickTop // OOXTODO: XML_thickBottom XML_defaultRowHeight, OString::number(static_cast<double> (rDefData.mnHeight) / 20.0), + XML_customHeight, ToPsz(true), XML_zeroHeight, ToPsz( rDefData.IsHidden() ), XML_outlineLevelRow, OString::number(maRowBfr.GetHighestOutlineLevel()), XML_outlineLevelCol, OString::number(maColInfoBfr.GetHighestOutlineLevel()) );