diff --git a/components/fpspreadsheet/fpsnumformatparser.pas b/components/fpspreadsheet/fpsnumformatparser.pas index 3afa25b05..64a0e66e7 100644 --- a/components/fpspreadsheet/fpsnumformatparser.pas +++ b/components/fpspreadsheet/fpsnumformatparser.pas @@ -301,6 +301,8 @@ begin if section^.Elements[el].IntValue < 0 then section^.Kind := section^.Kind + [nfkTimeInterval]; end; + nftColor: + section^.Kind := section^.Kind + [nfkHasColor]; end; if FStatus <> psOK then diff --git a/components/fpspreadsheet/fpspreadsheetgrid.pas b/components/fpspreadsheet/fpspreadsheetgrid.pas index 565b410cd..a28770494 100644 --- a/components/fpspreadsheet/fpspreadsheetgrid.pas +++ b/components/fpspreadsheet/fpspreadsheetgrid.pas @@ -1440,9 +1440,9 @@ begin else if (Length(numFmt.Sections) > 2) and (lCell^.NumberValue = 0) then sidx := 2; - if numFmt.Sections[sidx].Elements[0].Token = nftColor then + if (nfkHasColor in numFmt.Sections[sidx].Kind) then begin - clr := numFmt.Sections[sidx].Elements[0].IntValue; + clr := numFmt.Sections[sidx].Color; Canvas.Font.Color := Workbook.GetPaletteColor(clr); end; end; diff --git a/components/fpspreadsheet/fpstypes.pas b/components/fpspreadsheet/fpstypes.pas index e28db7e59..f26f08dbc 100644 --- a/components/fpspreadsheet/fpstypes.pas +++ b/components/fpspreadsheet/fpstypes.pas @@ -500,7 +500,8 @@ type TsNumFormatElements = array of TsNumFormatElement; - TsNumFormatKind = (nfkPercent, nfkExp, nfkCurrency, nfkFraction, nfkDate, nfkTime, nfkTimeInterval); + TsNumFormatKind = (nfkPercent, nfkExp, nfkCurrency, nfkFraction, + nfkDate, nfkTime, nfkTimeInterval, nfkHasColor); TsNumFormatKinds = set of TsNumFormatKind; TsNumFormatSection = record