sc/qa/unit/data/xlsx/tdf41425.xlsx    |binary
 sc/qa/unit/subsequent_export-test.cxx |   15 +++++++++++++++
 sc/source/filter/excel/xetable.cxx    |    3 +++
 3 files changed, 18 insertions(+)

New commits:
commit 99b9ea63bfc9a5fe63a0cd7b30b66ce2c1bde08e
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Fri Aug 3 16:11:16 2018 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Fri Aug 10 09:23:17 2018 +0200

    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.
    
    Change-Id: Icac9441b7eb1520dcd20fc04337e070d070591c7
    Reviewed-on: https://gerrit.libreoffice.org/58575
    Tested-by: Jenkins
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/sc/qa/unit/data/xlsx/tdf41425.xlsx 
b/sc/qa/unit/data/xlsx/tdf41425.xlsx
new file mode 100644
index 000000000000..f7d3ec9ed6ec
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf41425.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 1b4f353fb2dd..4f30673e8c28 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -209,6 +209,7 @@ public:
     void testHiddenRepeatedRowsODS();
     void testHyperlinkTargetFrameODS();
     void testOpenDocumentAsReadOnly();
+    void testKeepSettingsOfBlankRows();
 
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
@@ -317,6 +318,7 @@ public:
     CPPUNIT_TEST(testHiddenRepeatedRowsODS);
     CPPUNIT_TEST(testHyperlinkTargetFrameODS);
     CPPUNIT_TEST(testOpenDocumentAsReadOnly);
+    CPPUNIT_TEST(testKeepSettingsOfBlankRows);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -4048,6 +4050,19 @@ void ScExportTest::testOpenDocumentAsReadOnly()
     xDocSh2->DoClose();
 }
 
+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 b68b094d0660..9f777e4c8f35 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -2455,6 +2455,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;
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to