I am working on C# VSTO(excel). I have created excel workbook project. I have been trying to i开发者_运维问答mplement Paste Special for my workbook.
Manually, we do paste special like This
But i need C# code to do the same.
Is there any way so i can apply it for every copy/cut paste operation in my excel workbook?
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.
Have you tried PasteSpecialmethod over ranges, it provides numerous options to copy formats/ column widths/ fomats with values etc.
Also there is another copy special to copy/paste as picture.
to copy 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.
Sheet.Paste()
// this will paste the shape in the sheet, to paste in some range you could use range.Paste()
精彩评论