积极答复者
c#抓取怎么完整抓取网页内容。图片、文字格式和网页一样,放置到richtextbox中

问题
答案
-
HtmlToRichTextbox 这个dll所提供的方法是我想要实现,但是它好像是针对了sliverlight,我在wpf中引用的时候,会出现The type'RichTextBox' is defined in an assembly that is not referenced.You must add a reference to assembly 'System.Windows,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e'. 这个问题 我尝试了搜索相关答案,最后有一种解答是说sliverlight和wpf程序集引用,必须要分别编译,是这样的吗?
Hi,
抱歉,我没有注意到HtmlToRichTextbox 是 sliverlight编写的, sliverlight和WPF程序集使用的不是同一套SDK, 两者是不能混用的。 你参考这个来编写WPF可以使用的代码。
另外,请参考下面这个链接。
Converting between RTF and HTML
https://code.msdn.microsoft.com/Converting-between-RTF-and-aaa02a6e
Best Regards,
Bob
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.- 已标记为答案 大星 2017年7月21日 1:26
全部回复
-
Hi,
你可以借助一些第三方开源工具,请参考以下工具:
Html To RichTextBox
http://htmltorichtextbox.codeplex.com/
XHTML2RTF: An HTML to RTF conversion tool based on XSL
https://www.codeproject.com/Articles/7087/XHTML-RTF-An-HTML-to-RTF-conversion-tool-based-on
使用webbrowser控件来操作:
Parsing HTML to get content using C#
http://stackoverflow.com/questions/2038104/parsing-html-to-get-content-using-c-sharp
Displaying HTML in a WPF RichTextBox
https://www.codeproject.com/Articles/1097390/Displaying-HTML-in-a-WPF-RichTextBox
How do I convert HTML to RTF (Rich Text) in .NET without paying for a component?
http://stackoverflow.com/questions/2627991/how-to-show-html-contents-with-a-richtextbox
Best Regards,
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com. -
HtmlToRichTextbox 这个dll所提供的方法是我想要实现,但是它好像是针对了sliverlight,我在wpf中引用的时候,会出现The type'RichTextBox' is defined in an assembly that is not referenced.You must add a reference to assembly 'System.Windows,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e'. 这个问题 我尝试了搜索相关答案,最后有一种解答是说sliverlight和wpf程序集引用,必须要分别编译,是这样的吗?
-
HtmlToRichTextbox 这个dll所提供的方法是我想要实现,但是它好像是针对了sliverlight,我在wpf中引用的时候,会出现The type'RichTextBox' is defined in an assembly that is not referenced.You must add a reference to assembly 'System.Windows,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e'. 这个问题 我尝试了搜索相关答案,最后有一种解答是说sliverlight和wpf程序集引用,必须要分别编译,是这样的吗?
Hi,
抱歉,我没有注意到HtmlToRichTextbox 是 sliverlight编写的, sliverlight和WPF程序集使用的不是同一套SDK, 两者是不能混用的。 你参考这个来编写WPF可以使用的代码。
另外,请参考下面这个链接。
Converting between RTF and HTML
https://code.msdn.microsoft.com/Converting-between-RTF-and-aaa02a6e
Best Regards,
Bob
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.- 已标记为答案 大星 2017年7月21日 1:26