visual studio 2008 - Paste Special in C# vsto Excel -
i working on c# vsto excel application.
whenever user pastes in excel template excel sheet,it pastes cell format along cell data in excel template. want avoid this. googled & came across term paste special.
paste special paste contents , no alter format of current sheet.
i want introduce paste special option in vsto application.
i have code here,
application.onkey("^v", "pastespecv");
but not working... can 1 me ?
- download dll http://globalmousekeyhook.codeplex.com/
add reference mousekeyboardactivitymonitor.dll
private keyboardhooklistener k_keylistener; private void thisworkbook_startup(object sender, system.eventargs e) { k_keylistener = new keyboardhooklistener(new apphooker()); k_keylistener.enabled = true; k_keylistener.keydown += new keyeventhandler(k_keylistener_keydown); } void k_keylistener_keydown(object sender, keyeventargs e) { if (control.modifierkeys == keys.control) if (e.keycode == keys.v) { worksheet actsht = activesheet worksheet; range rng = actsht.application.selection range; if (messagebox.show("you paste values only. want continue?", "paste confirmation", messageboxbuttons.yesno, messageboxicon.question) == dialogresult.yes) { rng.pastespecial(xlpastetype.xlpastevalues, xlpastespecialoperation.xlpastespecialoperationnone, false, false); } e.handled = true; } }
Comments
Post a Comment