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

Eike Rathke erack at redhat.com
Fri Mar 2 15:29:15 UTC 2018


 sc/source/filter/oox/worksheethelper.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit ccc977ba10b61108a56e00a79c0f7a1517e026cc
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Mar 2 16:27:40 2018 +0100

    Related: tdf#114555 cater for lastcolumn+1 oddity if last is last possible
    
    Else our own saved .xlsx files raise the excess columns warning.
    
    Change-Id: Ie1791dd026d9faf4b391ad34da43ec0c70c8de83

diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 0f0c5370ef12..5f7dfeb36426 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -763,8 +763,14 @@ void WorksheetGlobals::setColumnModel( const ColumnModel& rModel )
     sal_Int32 nLastCol = rModel.maRange.mnLast - 1;
     if( getAddressConverter().checkCol( nFirstCol, true ) && (nFirstCol <= nLastCol) )
     {
-        // validate last column index
-        if( !getAddressConverter().checkCol( nLastCol, true ) )
+        // Validate last column index.
+        // If last column is equal to last possible column, Excel adds one
+        // more. We do that also in XclExpColinfo::SaveXml() and for 1024 end
+        // up with 1025 instead, which would lead to excess columns in
+        // checkCol(). Cater for this oddity.
+        if (nLastCol == mrMaxApiPos.Col() + 1)
+            --nLastCol;
+        else if( !getAddressConverter().checkCol( nLastCol, true ) )
             nLastCol = mrMaxApiPos.Col();
         // try to find entry in column model map that is able to merge with the passed model
         bool bInsertModel = true;


More information about the Libreoffice-commits mailing list