diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2016-08-12 10:51:11 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-02-08 11:56:05 +0100 |
commit | 844c10ed6d89ae62492a24a3ce42f53dbdc98b5b (patch) | |
tree | dfcc960b9d7c88ea60c16c4f735b279f48c85c7a /sc | |
parent | ad42a293ffa04d1bc18b96dc011458332f751b18 (diff) |
tdf#70565 Set correct default values to "0" of xfId attribute
When xfId is not exist during .xlsx import
it must have values set to "0".
It is not impacts spreadsheets created with MS Excel,
as xfId attribute is always created during export to .xlsx
Not setting "0" value is causing wrong .xlsx import by LibreOffice,
for spreadsheets created by external applications (ex. SAP BI).
Change-Id: Ia4986236d5e902d0ff6f7a7a8da8f142b2c5061f
Reviewed-on: https://gerrit.libreoffice.org/28069
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
(cherry picked from commit 9b9bcef5ef1858c63c8708bfae2ecea3d398eeb8)
Reviewed-on: https://gerrit.libreoffice.org/31647
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit c88c3f66984df5ac4ca65431e7eacbeb93cb2217)
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/xlsx/xf_default_values.xlsx | bin | 0 -> 11280 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 26 |
2 files changed, 25 insertions, 1 deletions
diff --git a/sc/qa/unit/data/xlsx/xf_default_values.xlsx b/sc/qa/unit/data/xlsx/xf_default_values.xlsx Binary files differnew file mode 100644 index 000000000000..79aaea7c90fd --- /dev/null +++ b/sc/qa/unit/data/xlsx/xf_default_values.xlsx diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 11b592a8b3be..fdbc3fdb1386 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -109,6 +109,7 @@ public: void testFormatExportODS(); void testCustomColumnWidthExportXLSX(); + void testXfDefaultValuesXLSX(); void testOutlineExportXLSX(); void testHiddenEmptyRowsXLSX(); void testLandscapeOrientationXLSX(); @@ -188,6 +189,7 @@ public: CPPUNIT_TEST(testFormatExportODS); CPPUNIT_TEST(testCustomColumnWidthExportXLSX); + CPPUNIT_TEST(testXfDefaultValuesXLSX); CPPUNIT_TEST(testOutlineExportXLSX); CPPUNIT_TEST(testHiddenEmptyRowsXLSX); CPPUNIT_TEST(testLandscapeOrientationXLSX); @@ -463,7 +465,6 @@ void ScExportTest::testFormatExportODS() xDocSh->DoClose(); } - void ScExportTest::testCustomColumnWidthExportXLSX() { //tdf#100946 FILESAVE Excel on OS X ignored column widths in XLSX last saved by LO @@ -556,6 +557,29 @@ void ScExportTest::testCustomColumnWidthExportXLSX() assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "customHeight", "false"); } +void ScExportTest::testXfDefaultValuesXLSX() +{ + //tdf#70565 FORMATTING: User Defined Custom Formatting is not applied during importing XLSX documents + ScDocShellRef xShell = loadDoc("xf_default_values.", FORMAT_XLSX); + CPPUNIT_ASSERT(xShell.Is()); + + std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); + xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/styles.xml"); + CPPUNIT_ASSERT(pSheet); + + // cellStyleXfs don't need xfId, so we need to make sure it is not saved + assertXPathNoAttribute(pSheet, "/x:styleSheet/x:cellStyleXfs/x:xf[1]", "xfId"); + + // Because numFmtId fontId fillId borderId xfId are not existing during import + // it should be created during export, with values set to "0" + assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[1]", "xfId", "0"); + assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[2]", "xfId", "0"); + assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[3]", "xfId", "0"); + assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[4]", "xfId", "0"); + + // We expected that exactly 15 cellXfs:xf Nodes will be produced + assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf", 14); +} void ScExportTest::testOutlineExportXLSX() { |