From 7e91f6373f3fe43b9897bc1a4698a9e4e1c9ff4b Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sat, 18 Feb 2017 18:19:53 +0000 Subject: [PATCH] fpspreadsheet: Fix different listseparator used in formulas of ods files written by Excel. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5754 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../fpspreadsheet/source/common/fpsopendocument.pas | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/fpspreadsheet/source/common/fpsopendocument.pas b/components/fpspreadsheet/source/common/fpsopendocument.pas index 1153ffe98..7250c85bb 100644 --- a/components/fpspreadsheet/source/common/fpsopendocument.pas +++ b/components/fpspreadsheet/source/common/fpsopendocument.pas @@ -2279,6 +2279,7 @@ var parser: TsSpreadsheetParser; p: Integer; fmt: PsCellFormat; + ns: String; begin // Create cell and apply format if FIsVirtualMode then @@ -2302,8 +2303,14 @@ begin formula := GetAttrValue(ACellNode, 'table:formula'); if formula <> '' then begin - // formulas written by Spread begin with 'of:=', our's with '=' --> remove that + // Formulas written by Spread begin with 'of:=', by Excel with 'msof:='. + // Remove that. And both use different list separators p := pos('=', formula); + ns := Copy(formula, 1, p-2); + case ns of + 'of' : FPointSeparatorSettings.ListSeparator := ';'; + 'msoxl': FPointSeparatorSettings.ListSeparator := ','; + end; Delete(formula, 1, p); end; // ... convert to Excel "A1" dialect used by fps by defailt