简体   繁体   English

如何使用c#Word Interop清除MS Office剪贴板

[英]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.

相关问题 如何使用矢量 + Ms Graph 和 C# office interop 词库在词自动化中绘制图表(图表) - How to Draw diagrams (Charts) in word automation using vectors + Ms Graph with C# office interop word library 使用C#中的Microsoft.Office.Interop.Word在MS Word中查找具有指定字体的文本 - Finding Text With specified font in MS word using Microsoft.Office.Interop.Word in c# 如何在没有office.word.interop C#的情况下将带有图表的MS Word文档转换为PDF - How to convert MS word document with chart in it to PDF without office.word.interop c# 使用C#Interop清除/清空办公室剪贴板 - Clearing/Emptying office clipboard using C# Interop 如何将整个datagridview导出成word文档(在C#中使用office word interop DLL) - How to export the entire datagridview into a word document (using office word interop DLL in C#) 如何使用Microsoft.Office.Interop.Word在C#中从Word文件中查找突出显示的文本? - How to find highlighted text from Word file in C# using Microsoft.Office.Interop.Word? 如何在C#中使用Microsoft.Office.Interop.Word从Word文件(.Docx)中按页获取文本 - How to get text by page from word file (.Docx) using Microsoft.Office.Interop.Word in C# 如何使用microsoft.office.interop.word c#从word文件中获取段落和形状 - How to get paragraphs and shapes from word file using microsoft.office.interop.word c# 如何使用Microsoft.Office.Interop.Word C#在Word文档中插入/获取封面 - How to insert/fetch a cover page in word document using Microsoft.Office.Interop.Word C# C#Word Interop,将剪贴板粘贴到段落中 - C# Word Interop, Pasting Clipboard into Paragraph
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM