summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/qa/unit/data/ods/fdo62729.odsbin0 -> 6772 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx30
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx1
3 files changed, 31 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/fdo62729.ods b/sc/qa/unit/data/ods/fdo62729.ods
new file mode 100644
index 000000000000..00b50798f6bc
--- /dev/null
+++ b/sc/qa/unit/data/ods/fdo62729.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 5dbadba82182..ed23eeedb566 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -52,6 +52,7 @@ public:
void testDataBarExportODS();
void testDataBarExportXLSX();
void testMiscRowHeightExport();
+ void testNamedRangeBugfdo62729();
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
@@ -63,6 +64,7 @@ public:
CPPUNIT_TEST(testColorScaleExportODS);
CPPUNIT_TEST(testColorScaleExportXLSX);
CPPUNIT_TEST(testMiscRowHeightExport);
+ CPPUNIT_TEST(testNamedRangeBugfdo62729);
CPPUNIT_TEST_SUITE_END();
private:
@@ -292,6 +294,34 @@ void ScExportTest::testMiscRowHeightExport()
miscRowHeightsTest( aTestValues, SAL_N_ELEMENTS(aTestValues) );
}
+
+void ScExportTest::testNamedRangeBugfdo62729()
+{
+ ScDocShellRef xShell = loadDoc("fdo62729.", ODS);
+ CPPUNIT_ASSERT(xShell.Is());
+ ScDocument* pDoc = xShell->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+
+ ScRangeName* pNames = pDoc->GetRangeName();
+ //should be just a single named range
+ CPPUNIT_ASSERT(pNames->size() == 1 );
+ pDoc->DeleteTab(0);
+ //should be still a single named range
+ CPPUNIT_ASSERT(pNames->size() == 1 );
+ ScDocShellRef xDocSh = saveAndReload(xShell, ODS);
+ xShell->DoClose();
+
+ CPPUNIT_ASSERT(xDocSh.Is());
+ pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+
+ pNames = pDoc->GetRangeName();
+ //after reload should still have a named range
+ CPPUNIT_ASSERT(pNames->size() == 1 );
+
+ xDocSh->DoClose();
+}
+
ScExportTest::ScExportTest()
: ScBootstrapFixture("/sc/qa/unit/data")
{
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 2a543cdfddd8..73b3aec34b33 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3738,6 +3738,7 @@ void ScXMLExport::WriteNamedRange(ScRangeName* pRangeName)
AddAttribute(sAttrName, it->second->GetName());
OUString sBaseCellAddress;
+ it->second->ValidateTabRefs();
ScRangeStringConverter::GetStringFromAddress( sBaseCellAddress, it->second->GetPos(), pDoc,
FormulaGrammar::CONV_OOO, ' ', false, SCA_ABS_3D);
AddAttribute(XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, sBaseCellAddress);