summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorAttila Szűcs <szucs.attila3@nisz.hu>2021-10-15 13:55:36 +0200
committerLászló Németh <nemeth@numbertext.org>2021-10-26 11:13:45 +0200
commit69424f0fd66a74dbabba66c9c7fb1420aa1ff4e9 (patch)
tree153ca47a74abc2b999a5c33c2c5bb5dd5efe0fbd /sc
parentaa83a2dbb727b95c3ee162d6f382a857505dea5a (diff)
tdf#145129 XLSX import: round down default row height
like table layout of MSO does, e.g. 20 pt to 19.5 pt. Same as tdf#144642, but with default row height. Follow-up to commit 537cb82be8fa021fd9382cca874645c75daaef20 "tdf#144642 XLSX import: round down row height to 0.75 pt". Co-authored-by: Tibor Nagy (NISZ) Change-Id: Iefb615b56e5ddc11a5e839cf6d90516b18646045 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123655 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/xlsx/tdf145129_DefaultRowHeight_28.35pt_SavedByExcel.xlsxbin0 -> 10850 bytes
-rw-r--r--sc/qa/unit/subsequent_export_test2.cxx17
-rw-r--r--sc/source/filter/oox/worksheetfragment.cxx7
3 files changed, 23 insertions, 1 deletions
diff --git a/sc/qa/unit/data/xlsx/tdf145129_DefaultRowHeight_28.35pt_SavedByExcel.xlsx b/sc/qa/unit/data/xlsx/tdf145129_DefaultRowHeight_28.35pt_SavedByExcel.xlsx
new file mode 100644
index 000000000000..f8041d58eb65
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/tdf145129_DefaultRowHeight_28.35pt_SavedByExcel.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx
index 2be6a07c4af8..53aaedb48288 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -200,6 +200,7 @@ public:
void testTdf139258_rotated_image();
void testTdf142854_GridVisibilityImportXlsxInHeadlessMode();
void testTdf144642_RowHeightRounding();
+ void testTdf145129_DefaultRowHeightRounding();
void testTdf140431();
void testCheckboxFormControlXlsxExport();
void testButtonFormControlXlsxExport();
@@ -311,6 +312,7 @@ public:
CPPUNIT_TEST(testTdf139258_rotated_image);
CPPUNIT_TEST(testTdf142854_GridVisibilityImportXlsxInHeadlessMode);
CPPUNIT_TEST(testTdf144642_RowHeightRounding);
+ CPPUNIT_TEST(testTdf145129_DefaultRowHeightRounding);
CPPUNIT_TEST(testTdf140431);
CPPUNIT_TEST(testCheckboxFormControlXlsxExport);
CPPUNIT_TEST(testButtonFormControlXlsxExport);
@@ -2572,6 +2574,21 @@ void ScExportTest2::testTdf144642_RowHeightRounding()
xShell->DoClose();
}
+void ScExportTest2::testTdf145129_DefaultRowHeightRounding()
+{
+ // MS Excel round down row heights to 0.75pt
+ // Same as Tdf144642 but with default row height.
+
+ ScDocShellRef xShell
+ = loadDoc(u"tdf145129_DefaultRowHeight_28.35pt_SavedByExcel.", FORMAT_XLSX);
+ CPPUNIT_ASSERT(xShell.is());
+ ScDocument& rDoc = xShell->GetDocument();
+ // 555twips == 27.75pt == 9.79mm
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(555), rDoc.GetRowHeight(0, 0));
+ CPPUNIT_ASSERT_EQUAL(sal_uLong(555 * 52), rDoc.GetRowHeight(0, 51, 0, true));
+ xShell->DoClose();
+}
+
void ScExportTest2::testTdf140431()
{
ScDocShellRef xShell = loadDoc(u"129969-min.", FORMAT_XLSX);
diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx
index a0e01c915dcf..218ab447545b 100644
--- a/sc/source/filter/oox/worksheetfragment.cxx
+++ b/sc/source/filter/oox/worksheetfragment.cxx
@@ -667,8 +667,13 @@ void WorksheetFragment::importSheetFormatPr( const AttributeList& rAttribs )
// XML_outlineLevelRow
// XML_outlineLevelCol
// as it will be updated during export to OOXML
+ double fDefaultRowHeight = rAttribs.getDouble(XML_defaultRowHeight, 0.0);
+ if (getFilter().isMSODocument())
+ {
+ fDefaultRowHeight -= fmod(fDefaultRowHeight, 0.75); //round down to 0.75pt
+ }
setDefaultRowSettings(
- rAttribs.getDouble( XML_defaultRowHeight, 0.0 ),
+ fDefaultRowHeight,
rAttribs.getBool( XML_customHeight, false ),
rAttribs.getBool( XML_zeroHeight, false ),
rAttribs.getBool( XML_thickTop, false ),