如何从剪贴板将标准文件粘贴到磁盘 [英] How to paste standard file to the disk from Clipboard

查看:125
本文介绍了如何从剪贴板将标准文件粘贴到磁盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在Word文档中插入了一个文件(Insert-> File).我想将其保存到磁盘上的文件中.到目前为止,我已将InlineShape复制到剪贴板.然后使用以下命令获取文件.


Hi,
I got a embedded file in a word document (Insert-->File). And I want to save that to a file to the disk. So far I copied the InlineShape to the clipboard. Then used following to get the file.


IDataObject data = Clipboard.GetDataObject();
object fileobj;

if (data.GetDataPresent(DataFormats.EnhancedMetafile))
{
fileobj = data.GetData(DataFormats.EnhancedMetafile);
}


但最后一行抛出异常

如果我转到浏览的窗口并右键单击并粘贴,该文件将另存为我期望的文件.所以我知道文件已经复制到剪贴板了.但是如何使用代码保存它呢?
有什么想法吗?
干杯,
GMan


but last line throws an Exception

If I go to my windows explored and right click and paste, the file saves as a file I''m expecting. So I know the file has copied to the clipboard. But how to save that using code?
Any ideas?
Cheers,
GMan

推荐答案

您能否再解释一下您的问题,还可以同时发布您的异常详细信息.这将有助于我们找出根本原因.
Could you explain your question a little bit more and also can you please post your exception details as well. That would help us to identify the root cause.


这篇关于如何从剪贴板将标准文件粘贴到磁盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆