diff options
author | László Németh <nemeth@numbertext.org> | 2018-08-03 16:11:16 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-09-17 18:36:39 +0200 |
commit | f9df3478ace3fb3ea25d24c7bc8b6b72cd7f1729 (patch) | |
tree | f25bdfb61bbc07307553f80363a90e4d165b9de7 | |
parent | 83244cd67b23c68ab908221ff649ca7cd7ab2399 (diff) |
tdf#41425 XLS/XLSX export: workaround for style and validation loss
of cells of blank rows.
This workaround is probably a fix for problems of most users, but for
a full solution it needs to extend the workaround for all rows with not
default settings, also avoiding of the possible performance problems.
Note: the number 1000 of the extra rows came from a similar workaround used in
XLSX export of Google Spreadsheets, but instead of listing extra empty 1000
rows in OOXML, this fix writes only the cells with not default settings from
the extra 1000 blank rows.
Reviewed-on: https://gerrit.libreoffice.org/58575
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit 99b9ea63bfc9a5fe63a0cd7b30b66ce2c1bde08e)
Reviewed-on: https://gerrit.libreoffice.org/58812
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
(cherry picked from commit d7cbaac61b8f3575184c675a760907c3b4bb225e)
Change-Id: Icac9441b7eb1520dcd20fc04337e070d070591c7
-rw-r--r-- | sc/qa/unit/data/xlsx/tdf41425.xlsx | bin | 0 -> 5496 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 15 | ||||
-rw-r--r-- | sc/source/filter/excel/xetable.cxx | 3 |
3 files changed, 18 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/tdf41425.xlsx b/sc/qa/unit/data/xlsx/tdf41425.xlsx Binary files differnew file mode 100644 index 000000000000..f7d3ec9ed6ec --- /dev/null +++ b/sc/qa/unit/data/xlsx/tdf41425.xlsx diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 793b239d510d..36b3e9c8fd15 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -220,6 +220,7 @@ public: void testPivotTableOutlineModeXLSX(); void testPivotTableDuplicatedMemberFilterXLSX(); void testPivotTableTabularModeXLSX(); + void testKeepSettingsOfBlankRows(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -339,6 +340,7 @@ public: CPPUNIT_TEST(testPivotTableOutlineModeXLSX); CPPUNIT_TEST(testPivotTableDuplicatedMemberFilterXLSX); CPPUNIT_TEST(testPivotTableTabularModeXLSX); + CPPUNIT_TEST(testKeepSettingsOfBlankRows); CPPUNIT_TEST_SUITE_END(); @@ -5262,6 +5264,19 @@ void ScExportTest::testPivotTableTabularModeXLSX() assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]", "outline", "0"); } +void ScExportTest::testKeepSettingsOfBlankRows() +{ + ScDocShellRef xDocSh = loadDoc("tdf41425.", FORMAT_XLSX); + CPPUNIT_ASSERT(xDocSh.Is()); + + std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); + xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + CPPUNIT_ASSERT(pSheet); + + // saved blank row with not default setting in A2 + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 2); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 29257f2df5ed..12e5afc0b5a7 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2463,6 +2463,9 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : if(nLastUsedScCol > nMaxScCol) nLastUsedScCol = nMaxScCol; + // check extra blank rows to avoid of losing their not default settings (workaround for tdf#41425) + nLastUsedScRow += 1000; + if(nLastUsedScRow > nMaxScRow) nLastUsedScRow = nMaxScRow; |