diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2017-10-06 23:03:05 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-10-07 14:09:14 +0200 |
commit | 77cc0de89ddc097adce6d6ef2f4397c2f160461a (patch) | |
tree | c9b53fff0e42bcb9301d92c9720176add937d9a9 /sc | |
parent | 06104d00f01ce68e3e78f739d7a6bea110baf31b (diff) |
tdf#112946: Pivot table: Missing selector for a row field after RT in Calc
We need to explicitly set compact flags to false, since true is
the default. It seems MSO prefers compact mode, when the file
contains colliding mode flags.
Reviewed-on: https://gerrit.libreoffice.org/43210
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit ad439ded005cffd525ffe874f535fca7a4da1f49)
Change-Id: Ib311f1cf44345be294e6c6607c227c2baa0fb693
Reviewed-on: https://gerrit.libreoffice.org/43218
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sc')
-rwxr-xr-x | sc/qa/unit/data/xlsx/pivottable_outline_mode.xlsx | bin | 0 -> 12178 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 19 | ||||
-rw-r--r-- | sc/source/filter/excel/xepivotxml.cxx | 6 |
3 files changed, 25 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/pivottable_outline_mode.xlsx b/sc/qa/unit/data/xlsx/pivottable_outline_mode.xlsx Binary files differnew file mode 100755 index 000000000000..6b575c0af7b3 --- /dev/null +++ b/sc/qa/unit/data/xlsx/pivottable_outline_mode.xlsx diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index f9ac660b5321..ac0f2960abd3 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -214,6 +214,7 @@ public: void testPivotTableBoolFieldFilterXLSX(); void testPivotTableRowColPageFieldFilterXLSX(); void testPivotTableErrorItemFilterXLSX(); + void testPivotTableOutlineModeXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -328,6 +329,7 @@ public: CPPUNIT_TEST(testPivotTableBoolFieldFilterXLSX); CPPUNIT_TEST(testPivotTableRowColPageFieldFilterXLSX); CPPUNIT_TEST(testPivotTableErrorItemFilterXLSX); + CPPUNIT_TEST(testPivotTableOutlineModeXLSX); CPPUNIT_TEST_SUITE_END(); @@ -5156,6 +5158,23 @@ void ScExportTest::testPivotTableErrorItemFilterXLSX() xDocSh->DoClose(); } +void ScExportTest::testPivotTableOutlineModeXLSX() +{ + ScDocShellRef xShell = loadDoc("pivottable_outline_mode.", FORMAT_XLSX); + CPPUNIT_ASSERT(xShell.Is()); + + std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); + xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); + CPPUNIT_ASSERT(pTable); + + // Next to the outline flags, compact flags also should be set (true is the default) + assertXPath(pTable, "/x:pivotTableDefinition", "outline", "1"); + assertXPath(pTable, "/x:pivotTableDefinition", "outlineData", "1"); + assertXPath(pTable, "/x:pivotTableDefinition", "compact", "0"); + assertXPath(pTable, "/x:pivotTableDefinition", "compactData", "0"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]", "compact", "0"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index f29d312b0020..362e629482df 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -676,6 +676,8 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP XML_indent, XclXmlUtils::ToPsz10(false), XML_outline, XclXmlUtils::ToPsz10(true), XML_outlineData, XclXmlUtils::ToPsz10(true), + XML_compact, XclXmlUtils::ToPsz10(false), + XML_compactData, XclXmlUtils::ToPsz10(false), FSEND); // NB: Excel's range does not include page field area (if any). @@ -725,6 +727,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP { pPivotStrm->singleElement(XML_pivotField, XML_showAll, XclXmlUtils::ToPsz10(false), + XML_compact, XclXmlUtils::ToPsz10(false), FSEND); continue; } @@ -736,6 +739,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP { pPivotStrm->singleElement(XML_pivotField, XML_showAll, XclXmlUtils::ToPsz10(false), + XML_compact, XclXmlUtils::ToPsz10(false), FSEND); continue; } @@ -745,6 +749,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP pPivotStrm->singleElement(XML_pivotField, XML_dataField, XclXmlUtils::ToPsz10(true), XML_showAll, XclXmlUtils::ToPsz10(false), + XML_compact, XclXmlUtils::ToPsz10(false), FSEND); continue; @@ -812,6 +817,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP if (!bHasDefaultSubtotal) pAttList->add(XML_defaultSubtotal, XclXmlUtils::ToPsz10(false)); + pAttList->add( XML_compact, XclXmlUtils::ToPsz10(false)); sax_fastparser::XFastAttributeListRef xAttributeList(pAttList); pPivotStrm->startElement(XML_pivotField, xAttributeList); |