From ee32147ee46c894593f888933ebce91194dc055e Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sun, 26 Jul 2020 09:53:26 +0000 Subject: [PATCH] fpspreadsheet: More conservative handling of conditional font formatting by the ODS writer. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7563 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../fpspreadsheet/source/common/fpsopendocument.pas | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/fpspreadsheet/source/common/fpsopendocument.pas b/components/fpspreadsheet/source/common/fpsopendocument.pas index e24ae9a36..b765e27f2 100644 --- a/components/fpspreadsheet/source/common/fpsopendocument.pas +++ b/components/fpspreadsheet/source/common/fpsopendocument.pas @@ -8064,10 +8064,12 @@ begin defFnt := (Workbook as TsWorkbook).GetDefaultFont; if AFont = nil then AFont := defFnt; - Result := Result + Format('style:font-name="%s" ', [AFont.FontName]); + if AFont.FontName <> '' then + Result := Result + Format('style:font-name="%s" ', [AFont.FontName]); - Result := Result + Format('fo:font-size="%.1fpt" style:font-size-asian="%.1fpt" style:font-size-complex="%.1fpt" ', - [AFont.Size, AFont.Size, AFont.Size], FPointSeparatorSettings); + if AFont.Size > 0 then + Result := Result + Format('fo:font-size="%.1fpt" style:font-size-asian="%.1fpt" style:font-size-complex="%.1fpt" ', + [AFont.Size, AFont.Size, AFont.Size], FPointSeparatorSettings); if fssBold in AFont.Style then Result := Result + 'fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" '; @@ -8087,7 +8089,7 @@ begin if AFont.Position = fpSuperscript then Result := Result + 'style:text-position="super 58%" '; - if AFont.Color <> defFnt.Color then + if (AFont.Color <> defFnt.Color) and (AFont.Color <> scNotDefined) then Result := Result + Format('fo:color="%s" ', [ColorToHTMLColorStr(AFont.Color)]); end;