同时尝试通过以下代码将HTML转换为RTF
string html = "...."; // html content
RichTextBox rtbTemp = new RichTextBox();
WebBrowser wb = new WebBrowser();
wb.Navigate("about:blank");
wb.Document.Write(html);
wb.Document.ExecCommand("SelectAll", false, null);
wb.Document.ExecCommand("Copy", false, null);
rtbTemp.SelectAll();
rtbTemp.Paste();在这里,Document.Write(html);和Document.ExecCommand在这里得到错误,using需要克服这些错误,这是新的,请指导我们
示例:using System.Windows.Controls;
下面是完整的代码图像满
发布于 2021-12-09 17:05:42
您正在使用WPF WebBrowser控件。
不要使用System.Windows.Controls,而是使用WinForms:using System.Windows.Forms;
或者查看如何从WPF HtmlElementCollection WebBrowser获得WebBrowser?和如何从WebBrowser控件获取HTML,将WebBrowser.Document强制转换为适当的类型,或者在WPF窗口中承载控件。
https://stackoverflow.com/questions/70293589
复制相似问题