Joe W
Joe W

Reputation: 1890

How to clear the MS Office Clipboard using c# Word Interop

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.

Upvotes: 5

Views: 3218

Answers (1)

Cindy Meister
Cindy Meister

Reputation: 25693

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...

Upvotes: 1

Related Questions