I'm working with Word Interop to copy an entire document to do some logic. After I'm done, I want to clear the MS Office clipboard. This seems like a simple task... but I can't figure out how to do it.
var that = document.ActiveWindow.Selection;
that.WholeStory();
that.Copy();
// Do some logic with the selection
...
// Now I want to clear the MS Office clipboard.
Note 1: Clipboard.Clear() only clears the system-wide clipboard, but does not clear MS Office's clipboard.
Note 2: I realize that copying a document isn't the best way to work with the Document object, once I figure out this issue, I'll work on better logic.
The Office Clipboard is not exposed to the developer - there's no way to clear it, or to place any content specifically on it, or to "read" what it contains.
Whether there's a "better way" to copy a Word document depends very much on what you want/need to do with the content...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With