I have some rtf content which is stored in the database as varchar. They originated from RichTextBoxes.
I want to concatenate the rtf content and save them as a Word document. How can I do this?
I found that the RichTextBox class has a SaveFile method which I can use to save a DOCX:
objRichTextBox.SaveFile("Temp.docx", RichTextBoxStreamType.RichText);
However a problem occurs when I try to add RTF content to the RichTextBox:
RichTextBox objRichTextBox = new RichTextBox();
objRichTextBox.Rtf = objRichTextBox.Rtf + "Hello";
An unhandled exception of type 'System.ArgumentException' occurred in System.Windows.Forms.dll
Additional information: File format is not valid.
What am I doing wrong?