From f53c6649f5306952eda53679dc972e7cb73bde87 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sun, 26 Jul 2020 09:56:24 +0000 Subject: [PATCH] fpspreadsheet: Put conditional font handling in place for XLSX writer. Commented out, however, because Excel refuses to load such files (although syntactially correct). git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7564 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../fpspreadsheet/source/common/xlsxooxml.pas | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/components/fpspreadsheet/source/common/xlsxooxml.pas b/components/fpspreadsheet/source/common/xlsxooxml.pas index 1cf995585..c1e6d5e7a 100644 --- a/components/fpspreadsheet/source/common/xlsxooxml.pas +++ b/components/fpspreadsheet/source/common/xlsxooxml.pas @@ -6249,10 +6249,33 @@ procedure TsSpreadOOXMLWriter.WriteDifferentialFormat(AStream: TStream; var pt, bc, fc, diag: string; + font: TsFont; begin AppendToStream(AStream, ''); + { font } + // TODO: Fix font handling: although correct in syntax something seems to be missing... + { + if (uffFont in AFormat^.UsedFormattingFields) then + begin + font := TsWorkbook(FWorkbook).GetFont(AFormat^.FontIndex); + if font <> nil then + begin + AppendToStream(AStream, ''); + if font.Color <> scNotDefined then + AppendToStream(AStream, Format('', [fc] )); + if fssBold in font.Style then + AppendToStream(AStream, ''); + if fssItalic in font.Style then + AppendToStream(AStream, ''); + if fssStrikeout in font.Style then + AppendToStream(AStream, ''); + // Font name, font size, and style underline not supported + AppendToStream(AStream, ''); + end; + end; + } { background fill } if (uffBackground in AFormat^.UsedFormattingFields) then begin @@ -6291,26 +6314,6 @@ begin WriteBorderStyle(AStream, AFormat, cbDiagUp, 'diagonal'); AppendToStream(AStream, ''); - - // TODO: Fix font handling: although correct in syntax something seems to be missing... - { font } - { - font := TsWorkbook(FWorkbook).GetFont(AFormat^.FontIndex); - if font <> nil then - begin - fc := ColorToHTMLColorStr(font.Color, true); - AppendToStream(AStream, ''); - AppendToStream(AStream, Format('', [fc] )); - if fssBold in font.Style then - AppendToStream(AStream, ''); - if fssItalic in font.Style then - AppendToStream(AStream, ''); - if fssStrikeout in font.Style then - AppendToStream(AStream, ''); - // Font name, font size, and style underline not supported - AppendToStream(AStream, ''); - end; - } end; AppendToStream(AStream,