TurboPower_iPro: Add method SetHtmlFromFile (issue #37930, modified patch by Zaher Dirkey). Refactor SetHtmlFromStr.

git-svn-id: trunk@64024 -
This commit is contained in:
wp 2020-10-16 09:17:49 +00:00
parent e2c618e262
commit 1159625e7b

View File

@ -2818,6 +2818,7 @@ type
procedure SelectAll; procedure SelectAll;
procedure DeselectAll; procedure DeselectAll;
procedure SetHtml(NewHtml : TIpHtml); procedure SetHtml(NewHtml : TIpHtml);
procedure SetHtmlFromFile(const AFileName: String);
procedure SetHtmlFromStr(NewHtml : string); procedure SetHtmlFromStr(NewHtml : string);
procedure SetHtmlFromStream(NewHtml : TStream); procedure SetHtmlFromStream(NewHtml : TStream);
procedure Stop; procedure Stop;
@ -16063,16 +16064,28 @@ begin
end; end;
end; end;
procedure TIpHtmlCustomPanel.SetHtmlFromFile(const AFileName: String);
var
strm: TFileStream;
begin
strm := TFileStream.Create(AFileName, fmOpenRead + fmShareDenyNone);
try
SetHtmlFromStream(strm);
finally
strm.Free;
end;
end;
procedure TIpHtmlCustomPanel.SetHtmlFromStr(NewHtml: string); procedure TIpHtmlCustomPanel.SetHtmlFromStr(NewHtml: string);
var var
iphtml: TIpHtml; strm: TStringStream;
strm: TStringStream;
begin begin
iphtml:= TIpHtml.Create; strm:= TStringStream.Create(NewHtml);
strm:= TStringStream.Create(NewHtml); try
iphtml.LoadFromStream(strm); SetHtmlFromStream(strm);
SetHtml(iphtml); finally
strm.Free; strm.Free;
end;
end; end;
procedure TIpHtmlCustomPanel.SetHtmlFromStream(NewHtml: TStream); procedure TIpHtmlCustomPanel.SetHtmlFromStream(NewHtml: TStream);