0
How do I pass the information that is in a Richtextbox to a word document in C#.
Code:
String strtxt = rtbVertigo.Text;
TextWriter sw = new StreamWriter(@"D:\Users\edv\Desktop\WORD\Vertigo.doc");
sw.WriteLine(strtxt);
sw.Close();
MessageBox.Show("Dados exportados com sucesso");
Direct conversion from RTF to a Word document is not possible. Although you can simply save your RTF file and it will be compatible for reading in Word.
– Leandro Angelo
Thank you very much for the reply. After a few more attempts I managed to pass the information from RTF to a word. I edited the publication with the correct code
– Ider Odg
@Iderodg If you arrived at the solution yourself, post the solution as an answer. So the content is more organized and easy to find in the future by other people with similar problems. And don’t forget to mark an answer as accepted.
– Barbetta
Ideally, keep your question as it was and publish the solution as an answer or delete your question. And note that in your solution you are not converting a richtext into a word document, just reading the Plain text and writing inside a file with the extension. doc
– Leandro Angelo