Im trying to transfer some text from the richTextBox into an existing MS word template at a specific location.
I am able to transfer text to any location i like, but i want to retain the formatting of the text from the richTextBox.
Im trying to copy the text to the clipboard, and pasting it in Word, but its not working for some reason.
Microsoft.Office.Interop.Word.Selection sel = oWord.Selection; Clipboard.Clear(); //richTextBox4.SelectAll(); Clipboard.SetDataObject(richTextBox4.Rtf, true); IDataObject data = Clipboard.GetDataObject(); sel.InsertBefore(data.GetData(DataFormats.Rtf).ToString());
Can anyone tell me how to fix this, or is there any other way to transfer a chunk of text from richTextBox to MS Word without loosing the formatting.
please note: i know i can directly save data from richTextBox to an rtf or doc file.. i want to insert the data in an existing template.
Edited 7 Years Ago by jatin24: n/a