将RFT格式(Wordpad)保留在Richtextbox C#中 [英] Keep rft format (Wordpad) in richtextbox C#

查看:63
本文介绍了将RFT格式(Wordpad)保留在Richtextbox C#中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试通过以下代码在Richtextbox中加载rtf文件的内容:

richtextbox.LoadFile(path,RichTextBoxStreamType.RichText);

但是在richtextbox中会重置文本格式.

我该如何解决?

Hi all,

I''m trying to load the contnent of a rtf file in richtextbox by this code:

richtextbox.LoadFile(path,RichTextBoxStreamType.RichText);

but the text format is reset in richtextbox.

How can I solve this?

thanks.

推荐答案

检查使用Rtf 属性是否对您有帮助.
请参见此处 [
Check if using the Rtf property helps you.
See here[^].


1)检查它是您正在加载的RTF文件:使用记事本或类似文件以确保它充满了"/blah"语句.
2)检查它是有效的RTF文件:在写字板中打开它,并确保格式正确无误.
3)加载RichTextBox后,检查它的.Rtf属性-它看起来像您在记事本中检查的文件吗?
4)使用RichTextBox.SaveFile方法保存内容.按照上面的1)和2)进行检查.一样吗?

抱歉,但是对于您的问题的描述如此有限,所以不可能说执行此操作",它会解决问题!
1) Check it is an RTF file that you are loading: use Notepad or similar to ensure it is full of "/blah" statements.
2) Check it is a valid RTF file: Open it in WordPad and make sure your formatting is there and correct.
3) Examine the .Rtf property of the RichTextBox once it it loaded - does it look like the file you examined in Notepad?
4) Save the content using RichTextBox.SaveFile method. Examine it as in 1) and 2) above. Is it the same?

Sorry, but with such a limited description of your problem, it is not possible to say "do this" and it''ll fix it!


这篇关于将RFT格式(Wordpad)保留在Richtextbox C#中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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