ashe405
ashe405

Reputation: 59

Header in RichTextBox file gets removed

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?

Upvotes: 1

Views: 152

Answers (1)

Iman Sadeghi
Iman Sadeghi

Reputation: 26

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();

Upvotes: 1

Related Questions