From f8bfbd673f1485da8af2d41d2db75209ae3ecb3a Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Thu, 5 Oct 2017 11:41:32 +0000 Subject: [PATCH] fpspreadsheet: Fix ods writer crashing if number format has more than three sections. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6034 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../fpspreadsheet/source/common/fpsopendocument.pas | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/fpspreadsheet/source/common/fpsopendocument.pas b/components/fpspreadsheet/source/common/fpsopendocument.pas index 9fa79f5e7..684517452 100644 --- a/components/fpspreadsheet/source/common/fpsopendocument.pas +++ b/components/fpspreadsheet/source/common/fpsopendocument.pas @@ -684,10 +684,21 @@ var int,num,denom: Integer; begin Result := ''; + if ASection > 2 then // ods supports only at most 3 sections + exit; + + + + + if AFormatName = 'N1006' then + ns := 1; + ns := Length(FSections); if (ns = 0) then exit; + if ns > 3 then // ods supports only at most 3 sections + ns := 3; styleMapStr := ''; timeIntervalStr := ''; @@ -708,8 +719,10 @@ begin ''; + { else raise Exception.Create('At most 3 format sections allowed.'); + } end else AFormatName := AFormatName + 'P' + IntToStr(ASection);