From bac68e48c5bab9c0e8b48b6a9c2f5ef985a06cc6 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Thu, 5 Jun 2014 07:58:18 +0000 Subject: [PATCH] fpspreadsheet: Combine percentage format detection with other number formats (for ods) git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3140 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/fpsopendocument.pas | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/components/fpspreadsheet/fpsopendocument.pas b/components/fpspreadsheet/fpsopendocument.pas index 976374832..7e012f6a6 100755 --- a/components/fpspreadsheet/fpsopendocument.pas +++ b/components/fpspreadsheet/fpsopendocument.pas @@ -1020,6 +1020,9 @@ procedure TsSpreadOpenDocReader.ReadNumFormats(AStylesNode: TDOMNode); if node <> nil then ReadStyleMap(node, nf, fmt); + if ANumFormatNode.NodeName = 'number:percentage-style' then + nf := nfPercentage; + NumFormatList.AddFormat(ANumFormatName, fmt, nf, decs); end; @@ -1215,14 +1218,12 @@ begin numfmtName := GetAttrValue(NumFormatNode, 'style:name') else numfmtName := ''; - // Numbers (nfFixed, nfFixedTh, nfExp) - if numfmt_nodename = 'number:number-style' then + // Numbers (nfFixed, nfFixedTh, nfExp, nfPercentage) + if (numfmt_nodename = 'number:number-style') or + (numfmt_nodename = 'number:percentage-style') + then ReadNumberStyle(NumFormatNode, numfmtName); - // Percentage - if numfmt_nodename = 'number:percentage-style' then - ReadPercentageStyle(NumFormatNode, numfmtName); - // Date/time values if (numfmt_nodename = 'number:date-style') or (numfmt_nodename = 'number:time-style') then ReadDateTimeStyle(NumFormatNode, numfmtName);