[Libreoffice-commits] core.git: sc/qa sc/source
Tamás Zolnai
tamas.zolnai at collabora.com
Fri Oct 6 20:16:16 UTC 2017
sc/qa/unit/data/xlsx/pivottable_outline_mode.xlsx |binary
sc/qa/unit/subsequent_export-test.cxx | 19 +++++++++++++++++++
sc/source/filter/excel/xepivotxml.cxx | 6 ++++++
3 files changed, 25 insertions(+)
New commits:
commit ad439ded005cffd525ffe874f535fca7a4da1f49
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date: Fri Oct 6 20:35:54 2017 +0200
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.
Change-Id: Ib311f1cf44345be294e6c6607c227c2baa0fb693
Reviewed-on: https://gerrit.libreoffice.org/43210
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
diff --git a/sc/qa/unit/data/xlsx/pivottable_outline_mode.xlsx b/sc/qa/unit/data/xlsx/pivottable_outline_mode.xlsx
new file mode 100755
index 000000000000..6b575c0af7b3
Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivottable_outline_mode.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index d0596bdf06ef..21837ff11152 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -226,6 +226,7 @@ public:
void testPivotTableBoolFieldFilterXLSX();
void testPivotTableRowColPageFieldFilterXLSX();
void testPivotTableErrorItemFilterXLSX();
+ void testPivotTableOutlineModeXLSX();
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
@@ -346,6 +347,7 @@ public:
CPPUNIT_TEST(testPivotTableBoolFieldFilterXLSX);
CPPUNIT_TEST(testPivotTableRowColPageFieldFilterXLSX);
CPPUNIT_TEST(testPivotTableErrorItemFilterXLSX);
+ CPPUNIT_TEST(testPivotTableOutlineModeXLSX);
CPPUNIT_TEST_SUITE_END();
@@ -5251,6 +5253,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 9bc8836a57f4..6f9f7106f997 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -674,6 +674,8 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP
XML_indent, ToPsz10(false),
XML_outline, ToPsz10(true),
XML_outlineData, ToPsz10(true),
+ XML_compact, ToPsz10(false),
+ XML_compactData, ToPsz10(false),
FSEND);
// NB: Excel's range does not include page field area (if any).
@@ -723,6 +725,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP
{
pPivotStrm->singleElement(XML_pivotField,
XML_showAll, ToPsz10(false),
+ XML_compact, ToPsz10(false),
FSEND);
continue;
}
@@ -733,6 +736,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP
{
pPivotStrm->singleElement(XML_pivotField,
XML_showAll, ToPsz10(false),
+ XML_compact, ToPsz10(false),
FSEND);
continue;
}
@@ -742,6 +746,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP
pPivotStrm->singleElement(XML_pivotField,
XML_dataField, ToPsz10(true),
XML_showAll, ToPsz10(false),
+ XML_compact, ToPsz10(false),
FSEND);
continue;
@@ -810,6 +815,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP
if (!bHasDefaultSubtotal)
pAttList->add(XML_defaultSubtotal, ToPsz10(false));
+ pAttList->add( XML_compact, ToPsz10(false));
sax_fastparser::XFastAttributeListRef xAttributeList(pAttList);
pPivotStrm->startElement(XML_pivotField, xAttributeList);
More information about the Libreoffice-commits
mailing list