dr.doom
dr.doom

Reputation: 480

Loading rtf file to string to manipulate in C#

Is there a way to read rtf files into a string and then replace some patterns on them? Ideally I would want to save the new string into an rtf file again and open from wordpad. All I see is the richtextbox solution which i would like to skip.

I used to do that with, Microsoft.Office.Interop, by creating Word.Application then Word.Document then oDoc.Content.Find.Execute(FindText:="[[Blah Blah]]", ReplaceWith:="", Replace:=Word.WdReplace.wdReplaceAll) but I realize that Word might not always be installed on client...

Upvotes: 2

Views: 6568

Answers (1)

Till Hoffmann
Till Hoffmann

Reputation: 9877

Microsofts suggests using the RichTextBox control as documented here. This seems to be used by other members as mentioned in this thread.

However, there are some other solutions such as NRTFTree.

Upvotes: 1

Related Questions