[Libreoffice-commits] core.git: sc/qa sc/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 25 18:10:39 UTC 2019


 sc/qa/unit/subsequent_filters-test.cxx |   15 +++++++++++++++
 sc/source/filter/excel/colrowst.cxx    |    2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit e056abae09796f2b3806e94e62cae7f0d262d4d5
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Apr 25 15:30:49 2019 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Apr 25 20:09:39 2019 +0200

    tdf#50916: XLS: make sure to set default widths to all columns
    
    See https://lists.freedesktop.org/archives/libreoffice/2019-April/082479.html
    Ths partially reverts commit 1463625ae26900d2461fd72a5a2c894b9f1b8726
    
    Change-Id: I36ec01c8d331d879143f60e12dc239158a8822ec
    Reviewed-on: https://gerrit.libreoffice.org/71301
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 578ff72435d2..fa9abf92f4f1 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -248,6 +248,7 @@ public:
     void testTdf62268();
     void testVBAMacroFunctionODS();
     void testAutoheight2Rows();
+    void testXLSDefColWidth();
 
     CPPUNIT_TEST_SUITE(ScFiltersTest);
     CPPUNIT_TEST(testBooleanFormatXLSX);
@@ -387,6 +388,7 @@ public:
     CPPUNIT_TEST(testTdf62268);
     CPPUNIT_TEST(testVBAMacroFunctionODS);
     CPPUNIT_TEST(testAutoheight2Rows);
+    CPPUNIT_TEST(testXLSDefColWidth);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -4269,6 +4271,19 @@ void ScFiltersTest::testAutoheight2Rows()
     xDocSh->DoClose();
 }
 
+void ScFiltersTest::testXLSDefColWidth()
+{
+    // XLS has only 256 columns; but on import, we need to set default width to all above that limit
+    ScDocShellRef xDocSh = loadDoc("chartx.", FORMAT_XLS); // just some XLS with narrow columns
+    ScDocument& rDoc = xDocSh->GetDocument();
+
+    int nWidth = rDoc.GetColWidth(MAXCOL, 0, false);
+    // This was 1280
+    CPPUNIT_ASSERT_EQUAL(1005, nWidth);
+
+    xDocSh->DoClose();
+}
+
 ScFiltersTest::ScFiltersTest()
       : ScBootstrapFixture( "sc/qa/unit/data" )
 {
diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx
index 5640335f08b8..fb8e3e1c3836 100644
--- a/sc/source/filter/excel/colrowst.cxx
+++ b/sc/source/filter/excel/colrowst.cxx
@@ -184,7 +184,7 @@ void XclImpColRowSettings::Convert( SCTAB nScTab )
     // column widths ----------------------------------------------------------
 
     maColWidths.build_tree();
-    for( SCCOL nCol : rDoc.GetColumnsRange(nScTab, 0, MAXCOL) )
+    for (SCCOL nCol = 0; nCol <= MAXCOL; ++nCol)
     {
         sal_uInt16 nWidth = mnDefWidth;
         if (GetColFlag(nCol, ExcColRowFlags::Used))


More information about the Libreoffice-commits mailing list