【发布时间】:2017-01-31 12:00:39
【问题描述】:
本题涉及:Which is the best way to load a string (HTML code) in TWebBrowser?
我正在尝试使用 doc.body.style.fontFamily 更改 TWebBrowser 中的字体,但没有任何反应。字体仍然是 TimesNewRoman。
procedure THTMLEdit.SetHtmlCode(CONST HTMLCode: string);
VAR
Doc: Variant;
begin
if NOT Assigned(wbBrowser.Document)
then wbBrowser.Navigate('about:blank');
WHILE wbBrowser.ReadyState < READYSTATE_INTERACTIVE
DO Application.ProcessMessages;
Doc := wbBrowser.Document;
Doc.Clear;
Doc.Write(HTMLCode);
doc.body.style.fontFamily:='Arial'; <------ won't work
Doc.DesignMode := 'On';
Doc.Close;
end;
【问题讨论】:
-
这取决于页面的内容,它的样式。不会有单一的解决方案。你可以控制页面的内容,还是可以任意控制?#
-
内容是在 TWebBrowser 中创建的,而不是从 HTML 页面导入的。用户将输入粗体、项目符号等基本格式。因此,内容没有、、css等
标签: delphi font-face twebbrowser