[英]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. 我正在使用Word Interop复制整个文档来做一些逻辑。 After I'm done, I want to clear the MS Office clipboard. 完成后,我想清除MS Office剪贴板。 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. 注意1: Clipboard.Clear()仅清除系统范围的剪贴板,但不清除MS Office的剪贴板。
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. 注意2:我意识到复制文档不是使用Document对象的最佳方式,一旦我弄清楚这个问题,我就会研究更好的逻辑。
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. Office剪贴板不会向开发人员公开 - 无法清除它,或者无法在其上专门放置任何内容,或者“读取”它包含的内容。
Whether there's a "better way" to copy a Word document depends very much on what you want/need to do with the content... 复制Word文档是否有“更好的方法”在很大程度上取决于您对内容的需求/需要...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.