diff options
author | Justin Luth <justin_luth@sil.org> | 2021-12-08 14:22:01 +0200 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2021-12-11 07:20:35 +0100 |
commit | 297ab561c6754f89326a1e8ce1751233669578d7 (patch) | |
tree | b942b5a59beb4def1afd8ae3c3ec7a7172d1d2cb /sc | |
parent | 489d7298d2e609ee5900f05ba0064845a7a551ce (diff) |
tdf#128895 sc xmlimport: create enough dynamic cols if props
Since LO 6.3, only 64 columns are created by default,
where previously it was a fixed 1024.
A common user practice is to hide all columns not used,
but this collapsed property was lost because
only part of the columns were actually created and thus exported.
In this example, import specifies 1017 hidden columns (H-AMJ),
but since only 64 columns are created, export only specified 57.
So ensure that on import, any column with defined properties
is created - even if they don't contain any content.
Change-Id: If928880baf5585613715a1f4361a9059584d1ad2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126540
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods | bin | 0 -> 7210 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export_test.cxx | 18 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcoli.cxx | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods b/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods Binary files differnew file mode 100644 index 000000000000..fa016369f206 --- /dev/null +++ b/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index 355fdf4202ad..158323215660 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -143,6 +143,7 @@ public: #endif void testOutlineExportXLSX(); void testHiddenEmptyRowsXLSX(); + void testHiddenEmptyColsODS(); void testAllRowsHiddenXLSX(); void testLandscapeOrientationXLSX(); @@ -259,6 +260,7 @@ public: #endif CPPUNIT_TEST(testOutlineExportXLSX); CPPUNIT_TEST(testHiddenEmptyRowsXLSX); + CPPUNIT_TEST(testHiddenEmptyColsODS); CPPUNIT_TEST(testAllRowsHiddenXLSX); CPPUNIT_TEST(testLandscapeOrientationXLSX); CPPUNIT_TEST(testInlineArrayXLS); @@ -1525,6 +1527,22 @@ void ScExportTest::testHiddenEmptyRowsXLSX() xShell->DoClose(); } +void ScExportTest::testHiddenEmptyColsODS() +{ + //tdf#98106 FILESAVE: Hidden and empty rows became visible when export to .XLSX + ScDocShellRef xShell = loadDoc(u"tdf128895_emptyHiddenCols.", FORMAT_ODS); + CPPUNIT_ASSERT(xShell.is()); + + std::shared_ptr<utl::TempFile> pXPathFile + = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS); + xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); + CPPUNIT_ASSERT(pSheet); + assertXPath(pSheet, "//table:table/table:table-column[2]"); + assertXPath(pSheet, "//table:table/table:table-column[2]", "number-columns-repeated", "1017"); + + xShell->DoClose(); +} + void ScExportTest::testLandscapeOrientationXLSX() { //tdf#48767 - Landscape page orientation is not loaded from .xlsx format with MS Excel, after export with Libre Office diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx index 09224bb757a3..fc40a6f63c6b 100644 --- a/sc/source/filter/xml/xmlcoli.cxx +++ b/sc/source/filter/xml/xmlcoli.cxx @@ -93,6 +93,7 @@ void SAL_CALL ScXMLTableColContext::endFastElement( sal_Int32 /*nElement*/ ) nLastColumn = pDoc->MaxCol(); if (nCurrentColumn > pDoc->MaxCol()) nCurrentColumn = pDoc->MaxCol(); + pDoc->CreateColumnIfNotExists(nSheet, nLastColumn); uno::Reference<table::XColumnRowRange> xColumnRowRange (xSheet->getCellRangeByPosition(nCurrentColumn, 0, nLastColumn, 0), uno::UNO_QUERY); if (xColumnRowRange.is()) { |