【发布时间】:2019-05-20 09:30:44
【问题描述】:
当我使用 HTML 编辑器 (WebBrowser) 一次保存文本后再次打开它时,它包含旧的书面内容。如何清理内容?
我尝试将文档内容(例如在加载数据库条目时)设置为HTMLEditor.Document.Write("");,但它不起作用。
所以我将包含 WebControl 的表单加载为 FrameEditor viewer = new FrameEditor(); 但它没有帮助。
我试图 set _doc = null; _doc 是 IHTMLDocument2 和 _doc = modernHTMLEditor.Document.DomDocument as IHTMLDocument2;
我尝试将 HTMLEditor 重新加载为 HTMLEditor = new WebBrowser();
private IHTMLDocument2 _doc;
private void viewer_Load(object sender, EventArgs e)
{
_doc = null;
modernHTMLEditor.DocumentText = "<html><body></body></html>";
_doc =
modernHTMLEditor.Document.DomDocument as IHTMLDocument2;
modernHTMLEditor.Document.Write(DocText);
_doc.designMode = "On";
modernHTMLEditor.Document.ExecCommand("FontName", false, "Arial");
FontSizeSetup();
FontTypeSetup();
}
【问题讨论】: