edit richtextbox with word

  • Thread starter Thread starter Ludovic SOEUR
  • Start date Start date
L

Ludovic SOEUR

Suppose I have a .Net C# Winforms App with a RichTextBox control and I want
to provide an option for the user
to open the Rtf in Word, edit it in Word and get the edited value back to my
C# app dynamically (not with an external file).

Where should I start? Is there a document explaining this?
I read msdn but I did not see exactly what I am looking for

thanks,

Ludovic SOEUR
 
Open Word from your application (there are plenty of resources on how to do
this)
You can insert the text from the richtextbox by using
wordApp.Selection.TypeText(richTextBox1.Text); (wordApp being the Microsoft
Word Application object) (side note: this is a good read:
http://blogs.msdn.com/ptorr/archive/2004/02/05/67872.aspx)

Add a event Handler that fires some code when the document is closed (I
think its wordApp.DocumentBeforeClose)
clear your original rich text box..grab the range from the document and set
the richtextbox's text to the range.Text.
 
Thanks for the link but it still does not answer to my problem...how can I
keep rtf format from my RichTextBox to Word, to do changes in Word and then
to "update" my RichTextBox with the new rtf stream ?

Thanks,

Ludovic Soeur.
 
Back
Top