From e688582c1c4171aaff88283f096ac51efa0d0606 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Tue, 25 Jul 2017 09:40:05 +0000 Subject: [PATCH] fpspreadsheet: Fix xlsx reader getting dimension of an empty worksheet incorrectly. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5988 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/source/common/xlsxooxml.pas | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/fpspreadsheet/source/common/xlsxooxml.pas b/components/fpspreadsheet/source/common/xlsxooxml.pas index 44c84c0c7..c07599564 100644 --- a/components/fpspreadsheet/source/common/xlsxooxml.pas +++ b/components/fpspreadsheet/source/common/xlsxooxml.pas @@ -1271,6 +1271,7 @@ procedure TsSpreadOOXMLReader.ReadDimension(ANode: TDOMNode; var ref: String; r1, c1: Cardinal; + ok: Boolean; begin Unused(AWorksheet); @@ -1281,8 +1282,13 @@ begin exit; ref := GetAttrValue(ANode, 'ref'); - if ref <> '' then - ParseCellRangeString(ref, r1, c1, FLastRow, FLastCol); + if ref <> '' then begin + // Normally the range of worksheets is specified as, e.g., 'A1:K5' + ok := ParseCellRangeString(ref, r1, c1, FLastRow, FLastCol); + // But for empty worksheets it is specified as only 'A1' + if not ok then + ParseCellString(ref, FLastRow, FLastCol); + end; end; procedure TsSpreadOOXMLReader.ReadFileVersion(ANode: TDOMNode);