You've already forked lazarus-ccr
fpspreadsheet: Preserve spaces when parsing html text to be used as rich-text.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4464 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -592,6 +592,7 @@ type
|
|||||||
FFontStack: TsIntegerStack;
|
FFontStack: TsIntegerStack;
|
||||||
FCurrFont: TsFont;
|
FCurrFont: TsFont;
|
||||||
FPointSeparatorSettings: TFormatSettings;
|
FPointSeparatorSettings: TFormatSettings;
|
||||||
|
FPreserveSpaces: Boolean;
|
||||||
function AddFont(AFont: TsFont): Integer;
|
function AddFont(AFont: TsFont): Integer;
|
||||||
procedure AddRichTextParam(AFont: TsFont; AHyperlinkIndex: Integer = -1);
|
procedure AddRichTextParam(AFont: TsFont; AHyperlinkIndex: Integer = -1);
|
||||||
procedure ProcessFontRestore;
|
procedure ProcessFontRestore;
|
||||||
@ -603,6 +604,7 @@ type
|
|||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
property PlainText: String read FPlainText;
|
property PlainText: String read FPlainText;
|
||||||
property RichTextParams: TsRichTextParams read FRichTextParams;
|
property RichTextParams: TsRichTextParams read FRichTextParams;
|
||||||
|
property PreserveSpaces: Boolean read FPreserveSpaces write FPreserveSpaces;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TsHTMLAnalyzer.Create(AWorkbook: TsWorkbook; AFont: TsFont;
|
constructor TsHTMLAnalyzer.Create(AWorkbook: TsWorkbook; AFont: TsFont;
|
||||||
@ -885,6 +887,7 @@ end;
|
|||||||
|
|
||||||
procedure TsHTMLAnalyzer.TextFoundHandler(AText: String);
|
procedure TsHTMLAnalyzer.TextFoundHandler(AText: String);
|
||||||
begin
|
begin
|
||||||
|
if not FPreserveSpaces then
|
||||||
AText := CleanHTMLString(AText);
|
AText := CleanHTMLString(AText);
|
||||||
if AText <> '' then
|
if AText <> '' then
|
||||||
begin
|
begin
|
||||||
@ -909,6 +912,7 @@ var
|
|||||||
begin
|
begin
|
||||||
analyzer := TsHTMLAnalyzer.Create(AWorkbook, AFont, AHTMLText + '<end>');
|
analyzer := TsHTMLAnalyzer.Create(AWorkbook, AFont, AHTMLText + '<end>');
|
||||||
try
|
try
|
||||||
|
analyzer.PreserveSpaces := true;
|
||||||
analyzer.Exec;
|
analyzer.Exec;
|
||||||
APlainText := analyzer.PlainText;
|
APlainText := analyzer.PlainText;
|
||||||
SetLength(ARichTextParams, Length(analyzer.RichTextParams));
|
SetLength(ARichTextParams, Length(analyzer.RichTextParams));
|
||||||
|
Reference in New Issue
Block a user