Live Chat Icon For mobile
Live Chat Icon

How do I create and save a RichTextFormat (RTF) file?

Platform: WPF| Category: RichTextBox

One way to do this is to use the ‘RichTextBox.SaveFile()’ method.

[C#]

private void button1_Click( object sender, EventArgs e )
{
  // get a file name from the user
 SaveFileDialog saveFile1 = new SaveFileDialog();
  saveFile1.DefaultExt = '*.rtf';
  saveFile1.Filter = 'RTF Files|*.rtf';
  if ( saveFile1.ShowDialog() == DialogResult.OK )
    richTextBox1.SaveFile( saveFile1.FileName, RichTextBoxStreamType.RichText )
}

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.