在富文本框中打开HTML文件时出错 [英] Error opening an HTML file in rich text box

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

问题描述

我正在WPF中开发一个应用程序.我希望在富文本框中打开一些* .html文件.
我收到以下错误:无法访问C驱动器.
我正在使用以下代码.

I am developing an application in WPF. I want some *.html files to open in the rich text box.
I am getting the following error: Cannot access C drive.
I am using the following code.

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

                using (FileStream fs = File.Open(folderloc + display_lesson, FileMode.Open))

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



任何人都可以帮忙..
谢谢..



can any body help on this..
Thanks..

推荐答案

首先,当前不支持System.Windows.DataFormats.Html,因此,如果Open()调用成功,将引发异常. br/>
否则,问题听起来像是该进程没有足够的权限来访问文件.
First, System.Windows.DataFormats.Html isn''t currently supported so an exception will be thrown if the Open() call succeeds.

Otherwise, the issue sounds like the process not having sufficient permissions to access the file.


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

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