如何在富文本框中打开.html文件 [英] how to open .html file in rich text box

查看:775
本文介绍了如何在富文本框中打开.html文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有带有.htm扩展名的html文件数据...我想在WPF中的富文本框中打开该文件.我该怎么办..我的代码在下面...但是它给出了错误

''HTML Format'' data format not supported.<br />
Parameter name: dataFormat


richTextBox_LessonView.Document = new FlowDocument();
             TextRange documentTextRange = new TextRange(
                 richTextBox_LessonView.Document.ContentStart, richTextBox_LessonView.Document.ContentEnd);

             using (FileStream fs = File.Open("softskill.htm", FileMode.Open))

                 documentTextRange.Load(fs, System.Windows.DataFormats.Rtf);

解决方案

希望您会有所了解.
具有XAML/HTML转换器的可绑定WPF RichText编辑器

I have html files data which are with .htm extension...i want to open that file in rich text box in WPF..how can i do it..my code is below...but it gives error that

''HTML Format'' data format not supported.<br />
Parameter name: dataFormat


richTextBox_LessonView.Document = new FlowDocument();
             TextRange documentTextRange = new TextRange(
                 richTextBox_LessonView.Document.ContentStart, richTextBox_LessonView.Document.ContentEnd);

             using (FileStream fs = File.Open("softskill.htm", FileMode.Open))

                 documentTextRange.Load(fs, System.Windows.DataFormats.Rtf);

解决方案

Hope you will get concept.
Bindable WPF RichText Editor with XAML/HTML Convertor


这篇关于如何在富文本框中打开.html文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆