From 7a1caea387eae45d3c32c8708461e8135bbf84c2 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Fri, 29 May 2015 17:30:43 +0000 Subject: [PATCH] fpspreadsheet: Prev commit was not good, now ok. Also: Fix fraction formats with explicit denominator (such as "#/32"). git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4159 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/fpsnumformatparser.pas | 2 ++ components/fpspreadsheet/fpsutils.pas | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/fpspreadsheet/fpsnumformatparser.pas b/components/fpspreadsheet/fpsnumformatparser.pas index 7aeafe43d..d562bd5d5 100644 --- a/components/fpspreadsheet/fpsnumformatparser.pas +++ b/components/fpspreadsheet/fpsnumformatparser.pas @@ -317,6 +317,8 @@ begin section^.FracNumerator := section^.Elements[el].IntValue; nftFracDenomSpaceDigit, nftFracDenomZeroDigit: section^.FracDenominator := section^.Elements[el].IntValue; + nftFracDenom: + section^.FracDenominator := -section^.Elements[el].IntValue; nftPercent: section^.Kind := section^.Kind + [nfkPercent]; nftExpChar: diff --git a/components/fpspreadsheet/fpsutils.pas b/components/fpspreadsheet/fpsutils.pas index 33212f85a..3b5a3da7e 100644 --- a/components/fpspreadsheet/fpsutils.pas +++ b/components/fpspreadsheet/fpsutils.pas @@ -2579,15 +2579,14 @@ begin AIndex := j; if UseThSep then begin - AIndex := j + 1; + // AIndex := j + 1; j := Length(Result) - 2; while (j > 1) and (Result[j-1] <> ' ') and (Result[j] <> ' ') do begin Insert(fs.ThousandSeparator, Result, j); dec(j, 3); end; - end else - AIndex := j; + end; end; end; @@ -2729,7 +2728,7 @@ begin frnum := round(AValue*frdenom); end; sfrint := ProcessIntegerFormat(IntToStr(frint), fs, AElements, i, - INT_TOKENS, false, (AElements[i].Token = nftIntTh)); + INT_TOKENS + [nftIntTh], false, (AElements[i].Token = nftIntTh)); while (i < numEl) and (AElements[i].Token in TERMINATING_TOKENS) do begin sintnumspace := sintnumspace + AElements[i].TextValue;