1

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?

Stan1k
  • 338
  • 2
  • 17
ashe405
  • 59
  • 1
  • 9
  • Are you sure that provided info is enough? – Ivan Khorin Dec 27 '20 at 16:36
  • hello, i have original file this [link](https://srv-store6.gofile.io/download/Pcujph/orginal%20file.PNG) and AnswerRTF file this [link](https://srv-store6.gofile.io/download/Pcujph/1.txt) and result return file after use coding this file [link](https://srv-store6.gofile.io/download/Pcujph/after%20file.PNG) – ashe405 Dec 28 '20 at 09:40
  • i use code remove header file What is the problem? – ashe405 Dec 28 '20 at 09:41

1 Answers1

1

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