将RFT格式(Wordpad)保留在Richtextbox C#中

编程入门 行业动态 更新时间:2024-10-27 23:22:52
本文介绍了将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#中

本文发布于:2023-11-13 14:07:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584521.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:格式   RFT   Richtextbox   Wordpad

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!