Can I insert from clipboard to a Bookmark?

Clipboard.Clear(); 
Clipboard.SetText(text, TextDataFormat.Rtf);
oDoc.Bookmarks.get_Item(ref oBookMark).Range.Text = Clipboard.GetText();

Recommended Answers

All 2 Replies

Well... really the above code does not work. But this works.

Clipboard.Clear(); 
Clipboard.SetText(text, TextDataFormat.Rtf);
oDoc.Bookmarks.get_Item(ref oBookMark).Range.Select();
Microsoft.Office.Interop.Word.Selection sel =((Microsoft.Office.Interop.Word._Application)oDoc.Parent).Selection;
sel.Paste();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.