From 9b60ec63be7ea382c147b67f7c3d65aa00a7b803 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Mon, 16 Jun 2014 19:30:43 +0000 Subject: [PATCH] fpspreadsheet: Fix writing of percentage number formats to ods files. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3183 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/fpsopendocument.pas | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/components/fpspreadsheet/fpsopendocument.pas b/components/fpspreadsheet/fpsopendocument.pas index 8a276647d..c476e95c5 100755 --- a/components/fpspreadsheet/fpsopendocument.pas +++ b/components/fpspreadsheet/fpsopendocument.pas @@ -2483,8 +2483,6 @@ begin end; function TsSpreadOpenDocWriter.WriteRowStylesXMLAsString: string; -const - FALSE_TRUE: array[boolean] of string = ('false', 'true'); var i: Integer; s: String; @@ -2501,16 +2499,16 @@ begin // Column width Result := Result + - ' ' + LineEnding; + ' ' + LineEnding; // End Result := Result + ' ' + LineEnding; - Result := Format(Result, - [rowStyle.Name, rowStyle.RowHeight, FALSE_TRUE[rowStyle.AutoRowHeight]], - FPointSeparatorSettings - ); + Result := Format(Result, [rowStyle.Name, rowStyle.RowHeight], FPointSeparatorSettings); end; end; @@ -2883,10 +2881,14 @@ var DisplayStr: string; lStyle: string = ''; lIndex: Integer; + valType: String; begin + valType := 'float'; if ACell^.UsedFormattingFields <> [] then begin lIndex := FindFormattingInList(ACell); lStyle := ' table:style-name="ce' + IntToStr(lIndex) + '" '; + if pos('%', ACell^.NumberFormatStr) <> 0 then + valType := 'percentage'; end else lStyle := ''; @@ -2899,7 +2901,7 @@ begin DisplayStr:=FloatToStr(AValue); // Uses locale decimal separator end; FCellContent := - ' ' + LineEnding + + ' ' + LineEnding + ' ' + DisplayStr + '' + LineEnding + ' ' + LineEnding; end;