From 6f1b452469d53cdea673f5837c66f5887e52536d Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sun, 9 Aug 2015 10:11:04 +0000 Subject: [PATCH] fpspreadsheet: HTML reader supports and tags git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4259 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/fpshtml.pas | 24 ++++++++++++++++++----- components/fpspreadsheet/fpshtmlutils.pas | 7 +++---- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/components/fpspreadsheet/fpshtml.pas b/components/fpspreadsheet/fpshtml.pas index 65077c2c3..c8668ba08 100644 --- a/components/fpspreadsheet/fpshtml.pas +++ b/components/fpspreadsheet/fpshtml.pas @@ -458,8 +458,9 @@ var f: Double; defFntSize: Single; begin - // style tags - idx := FAttrList.IndexOfName('font-family'); + idx := FAttrList.IndexOfName('font-family'); // style tag + if idx = -1 then + idx := FAttrList.IndexOfName('face'); // html tag if idx > -1 then begin L := TStringList.Create; try @@ -472,6 +473,8 @@ begin end; idx := FAttrList.IndexOfName('font-size'); + if idx = -1 then + idx := FAttrList.IndexOfName('size'); if idx > -1 then begin defFntSize := FWorkbook.GetDefaultFont.Size; s := FAttrList[idx].Value; @@ -710,7 +713,7 @@ begin ReadHorAlign; ReadVertAlign; ReadFont(FCellFont); - if NoCaseTag[3] = 'H' then begin + if NoCaseTag[3] = 'H' then begin // for Include(FCellFont.Style, fssBold); FCurrCellFormat.HorAlignment := haCenter; Include(FCurrCellFormat.UsedFormattingFields, uffHorAlign); @@ -782,8 +785,19 @@ begin FCurrFont.Position := fpNormal else FCurrFont.Position := fpSuperscript; AddRichTextParam(FCurrFont); - end - else + end else + if (pos(' ';') do begin value := value + AStyle[i]; inc(i); end; - // inc(i); // skip final ';' Add(TsHTMLAttr.Create(lowercase(trim(nam)), UnquoteStr(trim(value)))); nam := ''; end; - ' ': ; + ' ': ; // skip white space else nam := nam + AStyle[i]; end; inc(i);