summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-03-02 16:27:40 +0100
committerEike Rathke <erack@redhat.com>2018-03-02 16:28:48 +0100
commitccc977ba10b61108a56e00a79c0f7a1517e026cc (patch)
treeebdb269093509e74bbf9eaa70964f08aa4dd4d45
parent58015c85ebc51571287255e5871901e72c4355e6 (diff)
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
-rw-r--r--sc/source/filter/oox/worksheethelper.cxx10
1 files changed, 8 insertions, 2 deletions
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;