fpspreadsheet: Fix regression in detection of decimal places for ods introduced by inconsistency of xml names in OpenDocument specification.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3191 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-06-18 07:44:02 +00:00
parent 9157573441
commit cf4ce9f2fa
2 changed files with 7 additions and 3 deletions

View File

@ -36,7 +36,8 @@ begin
MyWorksheet := MyWorkbook.AddWorksheet('My Worksheet');
// Write some cells
MyWorksheet.WriteNumber(0, 0, 1.0);// A1
MyWorksheet.WriteNumber(0, 0, 1.0, nfPercentage, 2);// A1
(*
MyWorksheet.WriteNumber(0, 1, 2.0);// B1
MyWorksheet.WriteNumber(0, 2, 3.0);// C1
MyWorksheet.WriteNumber(0, 3, 4.0);// D1
@ -234,7 +235,7 @@ begin
// Creates a new worksheet
MyWorksheet := MyWorkbook.AddWorksheet('My Worksheet 2');
*)
// Save the spreadsheet to a file
MyWorkbook.WriteToFile(MyDir + 'test.ods',
sfOpenDocument);

View File

@ -1375,7 +1375,10 @@ procedure TsSpreadOpenDocReader.ReadNumFormats(AStylesNode: TDOMNode);
Continue;
end else
if nodeName = 'number:number' then begin
s := GetAttrValue(node, 'decimal-places');
if ANumFormatName = 'number:currency-style' then
s := GetAttrValue(node, 'decimal-places')
else
s := GetAttrValue(node, 'number:decimal-places');
if s <> '' then decs := StrToInt(s) else decs := 0;
grouping := GetAttrValue(node, 'number:grouping') = 'true';
nf := IfThen(grouping, nfFixedTh, nfFixed);