From 8432eece0227327a0e17f15b41fa5d5029dd00a4 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Wed, 5 Aug 2015 19:32:27 +0000 Subject: [PATCH] fpspreadsheet: HTML reader reckignozes font specified in "styles" attribute of "table" element as default font of worksheet. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4255 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/fpshtml.pas | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/fpspreadsheet/fpshtml.pas b/components/fpspreadsheet/fpshtml.pas index 9d96fafa7..3a1eb948a 100644 --- a/components/fpspreadsheet/fpshtml.pas +++ b/components/fpspreadsheet/fpshtml.pas @@ -31,6 +31,7 @@ type FCurrRow, FCurrCol: LongInt; FCurrCellFormat: TsCellFormat; FCellFont: TsFont; + FCurrFont: TsFont; FCellText: String; FAttrList: TsHTMLAttrList; FColSpan, FRowSpan: Integer; @@ -148,10 +149,12 @@ begin FTableCounter := -1; FAttrList := TsHTMLAttrList.Create; FCellFont := TsFont.Create; + FCurrFont := TsFont.Create; end; destructor TsHTMLReader.Destroy; begin + FreeAndNil(FCurrFont); FreeAndNil(FCellFont); FreeAndNil(FAttrList); FreeAndNil(parser); @@ -480,6 +483,11 @@ begin FInTable := true; FCurrRow := -1; FCurrCol := -1; + InitFont(FCurrFont); + FAttrList.Parse(ActualTag); + ExtractFont(FCurrFont); + FWorkbook.ReplaceFont(DEFAULT_FONTINDEX, FCurrFont.FontName, FCurrFont.Size, + FCurrFont.Style, FCurrFont.Color, FCurrFont.Position); end else if FTableCounter = HTMLParams.TableIndex then begin