Disabled the Save and Print buttons in Word when editing Word attachments

This commit is contained in:
John Jenko 2017-07-07 17:52:36 +00:00
parent f4f52e2a84
commit f204e513de

View File

@ -122,14 +122,14 @@ namespace Volian.Controls.Library
{ {
SaveDSO(); SaveDSO();
} }
void _MyEdWord_BeforeDocumentOpened(object sender, EventArgs e)// B2017-133 Edraw void DisableWordCommands()// B2017-133 Edraw
{ {
_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableClose, true); _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableClose, true);
_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableNew, true); _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableNew, true);
_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrint, true); _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrint, true);
_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrintPreview, true); _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrintPreview, true);
_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrintQuick, true); _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrintQuick, true);
_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSave, false); _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSave, true);
_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSaveAs, true); _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSaveAs, true);
_MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypeSave, true); _MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypeSave, true);
_MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypeClose, true); _MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypeClose, true);
@ -137,6 +137,21 @@ namespace Volian.Controls.Library
_MyEdWord.DisableSaveHotKey(true); _MyEdWord.DisableSaveHotKey(true);
_MyEdWord.DisablePrintHotKey(true); _MyEdWord.DisablePrintHotKey(true);
} }
void _MyEdWord_BeforeDocumentOpened(object sender, EventArgs e)// B2017-133 Edraw
{
//_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableClose, true);
//_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableNew, true);
//_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrint, true);
//_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrintPreview, true);
//_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrintQuick, true);
//_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSave, true);
//_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSaveAs, true);
//_MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypeSave, true);
//_MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypeClose, true);
//_MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypePrint, true);
//_MyEdWord.DisableSaveHotKey(true);
//_MyEdWord.DisablePrintHotKey(true);
}
void _MyEdWord_BeforeDocumentClosed(object sender, EventArgs e)// B2017-133 Edraw void _MyEdWord_BeforeDocumentClosed(object sender, EventArgs e)// B2017-133 Edraw
{ {
Console.WriteLine("B2017-133 Edraw Before Document Closed"); Console.WriteLine("B2017-133 Edraw Before Document Closed");
@ -195,6 +210,7 @@ namespace Volian.Controls.Library
{ {
this._MyEdWord.LicenseName = "Volian7573291802";// B2017-133 Edraw this._MyEdWord.LicenseName = "Volian7573291802";// B2017-133 Edraw
this._MyEdWord.LicenseCode = "EDW8-5527-1201-AB8A";// B2017-133 Edraw this._MyEdWord.LicenseCode = "EDW8-5527-1201-AB8A";// B2017-133 Edraw
DisableWordCommands();
this._MyEdWord.Open(MyDSOFile.MyFile.FullName); this._MyEdWord.Open(MyDSOFile.MyFile.FullName);
} }
catch (Exception ex) catch (Exception ex)