From 7d38a1fa62b0f539f1d4e7b0a6d734d128014d6e Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Mon, 7 Nov 2016 13:47:57 +0000 Subject: [PATCH] fpspreadsheet: Improved handling of default cell format in ods. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5322 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../fpspreadsheet/source/common/fpsopendocument.pas | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/fpspreadsheet/source/common/fpsopendocument.pas b/components/fpspreadsheet/source/common/fpsopendocument.pas index d9010b0e2..1153ffe98 100644 --- a/components/fpspreadsheet/source/common/fpsopendocument.pas +++ b/components/fpspreadsheet/source/common/fpsopendocument.pas @@ -3986,6 +3986,7 @@ begin if not Assigned(AStylesNode) then exit; + nodeName := AStylesNode.NodeName; numFmtIndexDefault := FindNumFormatByName('N0'); styleNode := AStylesNode.FirstChild; @@ -3996,7 +3997,7 @@ begin family := GetAttrValue(stylenode, 'style:family'); if family = 'table-cell' then begin InitFormatRecord(fmt); - fmt.Name := 'Default'; + fmt.Name := 'DefaultStyle'; fnt := FWorkbook.GetFont(fmt.FontIndex); fntName := fnt.FontName; fntSize := fnt.Size; @@ -4054,6 +4055,12 @@ begin idx := FCellFormatList.FindIndexOfName(parentstyle); if idx > -1 then fmt := FCellFormatList[idx]^; + end else + if styleName <> '' then + begin + idx := FCellFormatList.FindIndexOfName(stylename); + if idx > -1 then + fmt := FCellFormatList[idx]^; end; fmt.Name := styleName;