Disable the Office Menu
Posted by office viewer on April 12th, 2011Edraw Office Viewer Components can disable the office main button and protect the opened document was modified by the end users. Only call the DisableFileCommand method in the BeforeDocumentOpen event and set the different enumerates.
boolean DisableFileCommand([in] WdUIType UIType, [in]
boolean Disable);
UIType: The enum type need to disable in the UI. WdUIType.
Disable: True to disable the command button or menu item.
enum WdUIType
{
wdUIDisalbeOfficeButton = 0x00000001,
wdUIDisalbeNew = 0x00000002,
wdUIDisalbeOpen = 0x00000004,
wdUIDisalbeUpgradeDocument = 0x00000008,
wdUIDisalbeSave = 0x00000010,
wdUIDisalbeSaveAs = 0x00000020,
wdUIDisalbeSendAsAttachment = 0x00000040,
wdUIDisalbeClose = 0x00000100,
wdUIDisalbePrint = 0x00000200,
wdUIDisalbePrintQuick = 0x00000400,
wdUIDisalbePrintPreview = 0x00000800,
wdUIDisalbeSaveAsMenu = 0x00001000,
wdUIDisalbePrepareMenu = 0x00002000,
wdUIDisalbePermissionRestrictMenu = 0x00004000,
wdUIDisalbeSendMenu = 0x00008000,
wdUIDisalbePublishMenu = 0x00010000,
wdUIDisalbeServerTasksMenu = 0x00020000,
wdUIDisalbeCopyButton = 0x00040000,
wdUIDisalbeCutButton = 0x00080000,
wdUIHideMenuHome = 0x01000000,
wdUIHideMenuInsert = 0x02000000,
wdUIHideMenuPageLayout = 0x04000000,
wdUIHideMenuReferences = 0x08000000,
wdUIHideMenuMailings = 0x10000000,
wdUIHideMenuReview = 0x20000000,
wdUIHideMenuView = 0x40000000,
wdUIHideMenuDeveloper = 0x80000000,
wdUIHideMenuAddIns = 0x00100000,
wdUIHideMenuFormat = 0x00200000,
wdUIHideMenuEdit = 0x00400000,
wdUIHideMenuTool = 0x00800000,
}WdUIType;
Note: The component disabled the Office menu, New button and Open
button in default.
DWORD dwDisableCommand = wdUIDisalbeOfficeButton |
wdUIDisalbeNew| wdUIDisalbeOpen;
The function need be set in the BeforeDocumentOpened event.
If you want to enable the three button, follow the samples.
Example
The following vb script shows how to enable the office main menu, new button and open
button.
Sub DocumentOpenedEvent ()
Edword.DisableFileCommand 1 , false ‘wdUIDisalbeOfficeButton
Edword.DisableFileCommand 2 , false ‘wdUIDisalbeNew
Edword.DisableFileCommand 4 , false ‘wdUIDisalbeOpen
End Sub
SCRIPT FOR=OA1 EVENT= DocumentOpened ()
DocumentOpenedEvent()
SCRIPT
The following vb script shows how to diable the saveas and save button.
Sub DocumentOpenedEvent ()
Edword.DisableFileCommand 16 , true ‘wdUIDisalbeSave
Edword.DisableFileCommand 32 , true ‘wdUIDisalbeSaveAs
End Sub
SCRIPT FOR=OA1 EVENT= DocumentOpened ()
DocumentOpenedEvent()
SCRIPT
Recent Comments