tdf#112106: Corrupted pivot table after XLSX -> XLS conversion in Calc
Always write out a data layout name. Change-Id: Ic0b43d9c0365eca5e417fe9f2fe4b77b538f3278 Reviewed-on: https://gerrit.libreoffice.org/41739 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
This commit is contained in:
BIN
sc/qa/unit/data/xlsx/tdf112106.xlsx
Executable file
BIN
sc/qa/unit/data/xlsx/tdf112106.xlsx
Executable file
Binary file not shown.
@@ -46,6 +46,8 @@
|
||||
#include <dputil.hxx>
|
||||
#include "validat.hxx"
|
||||
#include <attrib.hxx>
|
||||
#include "globstr.hrc"
|
||||
#include "global.hxx"
|
||||
|
||||
#include <svx/svdoole2.hxx>
|
||||
#include <svx/svdpage.hxx>
|
||||
@@ -207,6 +209,7 @@ public:
|
||||
|
||||
void testHiddenRepeatedRowsODS();
|
||||
void testHyperlinkTargetFrameODS();
|
||||
void testTdf112106();
|
||||
|
||||
CPPUNIT_TEST_SUITE(ScExportTest);
|
||||
CPPUNIT_TEST(test);
|
||||
@@ -310,6 +313,7 @@ public:
|
||||
CPPUNIT_TEST(testHiddenRepeatedRowsODS);
|
||||
CPPUNIT_TEST(testHyperlinkTargetFrameODS);
|
||||
|
||||
CPPUNIT_TEST(testTdf112106);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
private:
|
||||
@@ -4258,6 +4262,35 @@ void ScExportTest::testPivotTableRowHeaderXLS()
|
||||
xDocSh->DoClose();
|
||||
}
|
||||
|
||||
void ScExportTest::testTdf112106()
|
||||
{
|
||||
ScDocShellRef xDocSh = loadDoc("tdf112106.", FORMAT_XLSX);
|
||||
CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
|
||||
ScDocument& rDoc = xDocSh->GetDocument();
|
||||
ScDPCollection* pDPs = rDoc.GetDPCollection();
|
||||
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
|
||||
|
||||
// Reload and check data layout dim
|
||||
xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLS);
|
||||
CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
|
||||
ScDocument& rLoadedDoc = xDocSh->GetDocument();
|
||||
pDPs = rLoadedDoc.GetDPCollection();
|
||||
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
|
||||
const ScDPObject* pDPObj = &(*pDPs)[0];
|
||||
CPPUNIT_ASSERT(pDPObj);
|
||||
const ScDPSaveData* pSaveData = pDPObj->GetSaveData();
|
||||
CPPUNIT_ASSERT(pSaveData);
|
||||
|
||||
// Check that we have an existing data layout dimension
|
||||
const ScDPSaveDimension* pDim = pSaveData->GetExistingDataLayoutDimension();
|
||||
CPPUNIT_ASSERT(pDim);
|
||||
const OUString* pLayoutName = pDim->GetLayoutName();
|
||||
CPPUNIT_ASSERT(pLayoutName);
|
||||
CPPUNIT_ASSERT_EQUAL(ScGlobal::GetRscString(STR_PIVOT_DATA), (*pLayoutName));
|
||||
|
||||
xDocSh->DoClose();
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
@@ -1304,10 +1304,8 @@ void XclExpPivotTable::SetPropertiesFromDP( const ScDPSaveData& rSaveData )
|
||||
::set_flag( maPTExtInfo.mnFlags, EXC_SXEX_DRILLDOWN, rSaveData.GetDrillDown() );
|
||||
mbFilterBtn = rSaveData.GetFilterButton();
|
||||
const ScDPSaveDimension* pDim = rSaveData.GetExistingDataLayoutDimension();
|
||||
if (!pDim)
|
||||
return;
|
||||
|
||||
const OUString* pLayoutName = pDim->GetLayoutName();
|
||||
const OUString* pLayoutName = pDim ? pDim->GetLayoutName() : nullptr;
|
||||
if (pLayoutName)
|
||||
maPTInfo.maDataName = *pLayoutName;
|
||||
else
|
||||
|
Reference in New Issue
Block a user