How to load RichTextBox files of different formats (rtf, txt, pdf, doc, docx) into c #?

  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky

1 answer 1

You can load txt and rtf using RichTextBox.LoadFile , specifying the fileType parameter as RichTextBoxStreamType.UnicodePlainText or RichTextBoxStreamType.RichText .

To support pdf, doc, docx, look for third-party libraries.

With this, you can transfer the file from doc / docx formats to rtf on the fly (but you need Microsoft Word installed on the client machine).

For pdf it is suitable, for example, RichTextBox from Telerik , but it is, of course, paid. (However, this should not be your concern, but your employer.)