Cancel MS Office Standard Command
Download Office Viewer Component and View Sample Projects
Disable Office Standard Command
void DisableStandardCommand([in] CommandType CmdType, [in]
BOOL Disable);
Disables the standard file, save, print commands.
You can disable the standard commands in the office OCX. Then write your own process in the event.
enum CommandType{
cmdTypeSave = 0x00000001,
cmdTypeClose = 0x00000002,
cmdTypePrint = 0x00000004,
cmdTypeRightClick = 0x00000008,
cmdTypeDoubleClick = 0x00000010,
cmdTypeIESecurityReminder = 0x00000020,
}CommandType;
Sample code to cancel the Print event:
function OA_DocumentBeforePrint()
{
document.OA1.DisableStandardCommand(4, true);//cmdTypePrint = 0x00000004,
//add your own code here
}
<script language="javascript" for="OA1" event="DocumentBeforePrint()">
OA_DocumentBeforePrint();
</script>
Sample code to do own right click command:
function OA_DocumentBeforeRightClick()
{
document.OA1.DisableStandardCommand(8, true);//cmdTypeRightClick = 0x00000008,
//add your own code here
}
<script language="javascript" for="OA1" event="DocumentBeforeRightClick()">
OA_DocumentBeforeRightClick();
</script>
Integrate MS Office in Delphi Program
Embed Office in C# and Do Office Automation
Free Download Office Viewer Component and View Sample Projects