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>
This commit is contained in:
Justin Luth
2021-12-11 07:20:35 +01:00
committed by Justin Luth
parent 489d7298d2
commit 297ab561c6
3 changed files with 19 additions and 0 deletions
Binary file not shown.
+18
View File
@@ -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
+1
View File
@@ -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())
{