I use the following code:
RichTextBox rtf = new RichTextBox();
rtf.Rtf = AnswerRTF;
rtf.SaveFile(sourceFile + "/" + fileName);
for creating a RichTextBox
file
but this code removes Header
and Footer
after creating that file.
What is the problem?
You can Use the following code for create rtf file when you saved rtf file in a database :
string attachFile = Path.Combine(dataDirectory, fileName);
StreamWriter myStreamWriter = new StreamWriter(attachFile, true);
myStreamWriter.WriteLine(AnswerRTF);
myStreamWriter.WriteLine("}");
myStreamWriter.Close();