简体   繁体   English

使每一个复制和剪切粘贴外观特别粘贴

[英]Make every Copy and cut paste opearation Paste Special

I am working on C# VSTO(excel). 我正在使用C#VSTO(excel)。 I have created excel workbook project. 我已经创建了Excel工作簿项目。 I have been trying to implement Paste Special for my workbook. 我一直在尝试为我的工作簿实施“选择性粘贴”。

Manually, we do paste special like This 手动,我们会像这样 粘贴特殊

But i need C# code to do the same. 但是我需要C#代码来做同样的事情。

Is there any way so i can apply it for every copy/cut paste operation in my excel workbook? 有什么办法可以将其应用于Excel工作簿中的每个复制/剪切粘贴操作?

I don't want to use VBA Macros as it asks everytime user to whether he wants to ENABLE MACROS OR NOT and hence is there another way o accomplish this. 我不想使用VBA宏,因为它会询问每个用户是否要启用宏,因此还有另一种方法可以完成此操作。

Have you tried PasteSpecial method over ranges, it provides numerous options to copy formats/ column widths/ fomats with values etc. 您是否尝试过PasteSpecial方法超出范围,它提供了许多选项来复制带有值的格式/列宽/格式。

Also there is another copy special to copy/paste as picture. 此外,还有另一种特殊的副本可以复制/粘贴为图片。

to copy Range: Range.CopyPicture(xlPrinter, xlPicture); 复制Range:Range.CopyPicture(xlPrinter,xlPicture);
// the range gets copied in clipboard // there are options available like xlScreen in case you want to copy as it appears on screen. //范围将被复制到剪贴板中// //如果您要复制显示在屏幕上的内容,则可以使用xlScreen之类的选项。 Sheet.Paste() Sheet.Paste()
// this will paste the shape in the sheet, to paste in some range you could use range.Paste() //这会将形状粘贴到工作表中,以便粘贴到可以使用range.Paste()的某个范围内

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM