简体   繁体   English

如何阅读RTF的内容并分配给Richtextbox?

[英]How to read contents of RTF and assigned to Richtextbox?

I need to read more than 1 file rtf files and assigned to Richtextbox which in turn would be helpful in converting the same to pdf? 我需要读取1个以上的rtf文件并将其分配给Richtextbox,这反过来有助于将其转换为pdf?

thanks! 谢谢!

The RichTextBox class contains a function LoadFile(string path). RichTextBox类包含一个函数LoadFile(字符串路径)。 Pass the LoadPath function your the location of the file you want to load and it will display it. 将LoadPath函数传递给要加载的文件的位置,它将显示它。

If you modify the text, you can save it back out as an RTF file, by calling the RichTextBoxes SaveFile function. 如果修改了文本,则可以通过调用RichTextBoxes SaveFile函数将其另存为RTF文件。 See the reference below for further information. 有关更多信息,请参见下面的参考。

If you want to save a document to PDF you need to either print the file to a PDF after installing a PDF printing driver or you will need to use a third party API for creating documents that you can export to PDF. 如果要将文档保存为PDF,则需要在安装PDF打印驱动程序后将文件打印为PDF,或者需要使用第三方API创建可导出为PDF的文档。

Ref: http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox.aspx 参考: http : //msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM