I'm writing a Word Add-In to hightlight the source code.
I have colored the text in ICSharpCode.TextEditor.TexEditorControl and now I want to copy it to MS Word with these colors. If I do that by ctrl+c/ctrl+v all works fine. But how can I do it in c#?
Loading
lszkPosted Aug 3, 2008, 9:36 PM
lszkPosted Aug 3, 2008, 2:29 AM
http://img155.imageshack.us/my.php?image=beztytuuccxke0.png
This is the reason why I posted this topic.
Scott LyslePosted Aug 3, 2008, 2:03 AM
I am not familiar with that text editor control but with other controls such as a rich text box control, there are methods used to select all of the text, if select all of the text and copy it to the clipboard, you should be able to paste the contents with the formatting. For a rich text box control, the code would look like this:
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
{
rtbDoc.SelectAll();
Clipboard.SetText(rtbDoc.SelectedRtf, TextDataFormat.Rtf);
}