From 709be76b4fb23574eacb4a70b692b88a2b372164 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Wed, 4 Oct 2017 12:36:16 +0000 Subject: [PATCH] fpspreadsheet: Add support for xls one-parameter SUM formulas. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6031 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../fpspreadsheet/source/common/fpspreadsheet.pas | 3 +++ components/fpspreadsheet/source/common/xlsbiff2.pas | 3 ++- components/fpspreadsheet/source/common/xlscommon.pas | 11 ++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/components/fpspreadsheet/source/common/fpspreadsheet.pas b/components/fpspreadsheet/source/common/fpspreadsheet.pas index 3a81e1bdf..a7615fc67 100644 --- a/components/fpspreadsheet/source/common/fpspreadsheet.pas +++ b/components/fpspreadsheet/source/common/fpspreadsheet.pas @@ -2064,6 +2064,9 @@ begin destCol^.Col := AToCol; // ... and copy the format record - it may have be missing at destination CopyColFormat(srcCol, destCol, AFromWorksheet, self); + + // Notify visual controls of changes + ChangedCol(destCol^.Col); end; {@@ ---------------------------------------------------------------------------- diff --git a/components/fpspreadsheet/source/common/xlsbiff2.pas b/components/fpspreadsheet/source/common/xlsbiff2.pas index 46b3b1302..541ccf229 100644 --- a/components/fpspreadsheet/source/common/xlsbiff2.pas +++ b/components/fpspreadsheet/source/common/xlsbiff2.pas @@ -983,7 +983,8 @@ function TsSpreadBIFF2Reader.ReadRPNAttr(AStream: TStream; AIdentifier: Byte): B begin Result := false; case AIdentifier of - $01: AStream.ReadByte; // tAttrVolatile + $01: AStream.ReadByte; // tAttrVolatile, data not used + $10: AStream.ReadByte; // tAttrSum, data not used else exit; // others not supported by fpspreadsheet --> Result = false end; Result := true; diff --git a/components/fpspreadsheet/source/common/xlscommon.pas b/components/fpspreadsheet/source/common/xlscommon.pas index 5149d4d7c..d6fcd6ea1 100644 --- a/components/fpspreadsheet/source/common/xlscommon.pas +++ b/components/fpspreadsheet/source/common/xlscommon.pas @@ -2277,7 +2277,8 @@ function TsSpreadBIFFReader.ReadRPNAttr(AStream: TStream; AIdentifier: Byte): Bo begin Result := false; case AIdentifier of - $01: AStream.ReadWord; // tAttrVolatile token + $01: AStream.ReadWord; // tAttrVolatile token, data not used + $10: AStream.ReadWord; // tAttrSum token, data not used else exit; // others not supported by fps --> Result = false end; Result := true; @@ -2644,6 +2645,14 @@ begin begin b := AStream.ReadByte; supported := ReadRPNAttr(AStream, b); + if supported then begin + case b of + $10: + begin // one-parameter sum + rpnItem := RPNFunc('SUM', 1, rpnItem) + end; + end; + end; end; INT_EXCEL_TOKEN_TREFV: begin