Edraw Office Viewer Component is a standard ActiveX control that acts as
an ActiveX document container for hosting Microsoft Word
documents (including ppt, pps, pptx, ppsx files.) in a custom form or Web page. The
control is lightweight and flexible, and gives developers
new possibilities for using Word program in a custom
solution.
Customize the File Command
Event:
void
OnFileCommand([in]
FileCommandType
Item, [in,out]
VARIANT*
Cancel);
Description: Called when File menu item is selected
by user (may be canceled).
Every time a user opened a file successfully, the
OnDocumentOpened
event is raised. The event allows you to override the
default behavior for the control and supply your own
custom actions and dialog boxes to do normal file
operations.
VB 6.0
Private Sub
EDrawOfficeViewer1_OnFileCommand(ByVal Item As
EDrawOfficeViewerLib.FileCommandType, Cancel As Variant)
If Item =
FilePrint Then
MsgBox "You
asked to print, but I won't allow it."
Cancel = True
End If
End Sub
HTML + JScript
<script
language="JScript" for=EDrawOfficeViewer1 event="OnFileCommand
(Item,
Cancel)">
OnFileCommandEvent(Item, Cancel);
</script>
<script language=javascript>
function OnFileCommandEvent (Item, Cancel)
{
Alert(“Respond the File Command Event.”);
}
</script>
HTML + VBScript
<SCRIPT FOR= EDrawOfficeViewer1 EVENT= OnFileCommand
(Item, Cancel)>
OnFileCommandEvent(Item, Cancel)
</SCRIPT>
<script language=VBSrcript>
Sub
OnFileCommandEvent (Item, Cancel)
MsgBox “Respond the File Command Event.”
End
Sub
</script>
Document Opened Event
Event:
void
OnDocumentOpened([in]
BSTR
FileName, [in]
IDispatch*
Document);
Description: Called when document is opened or new
document added.
Every time a user opened a file successfully, the
OnDocumentOpened
event is raised. The event allows you to override the
default behavior for the control and supply your own
custom actions and dialog boxes to do normal file
operations.
HTML + JScript
<script
language="JScript" for=EDrawOfficeViewer1 event="
OnDocumentOpened(FileName,
Document)">
OnDocumentOpenedEvent(FileName,
Document);
</script>
<script language=javascript>
function
OnDocumentOpenedEvent(FileName,
Document)
{
Alert(“Respond the Document Opened Event.”);
}
</script>
Document Close Event
Event:
void
OnDocumentClosed();
Description: Called when document is closed.
Every time a user closed a file successfully, the
OnDocumentClosed
event is raised. The event allows you to override the
default behavior for the control and supply your own
custom actions and dialog boxes to do normal file
operations.
HTML + JScript
<script
language="JScript" for=EDrawOfficeViewer1 event="
OnDocumentClosed()">
OnDocumentClosedEvent();
</script>
<script language=javascript>
function
OnDocumentClosedEvent()
{
Alert(“Respond the Document Close Event.”);
}
</script>
Activation Change Event
Event:
void
OnActivationChange([in]
VARIANT
GoingActive);
Description: Called when component gains/loses
activation.
Every time a user opens a new document or closes a
document the
OnActivationChange
event is raised. The event allows you to override the
default behavior for the control and supply your own
custom actions and dialog boxes to do normal file
operations.
HTML + JScript
<script
language="JScript" for=EDrawOfficeViewer1 event="
OnActivationChange(GoingActive)">
OnActivationChangeEvent(GoingActive);
</script>
<script language=javascript>
function
OnActivationChangeEvent
(GoingActive)
{
Alert(“Respond the Activation Change Event.”);
}
</script>
Before Document Closed Event
Event:
void
BeforeDocumentClosed([in]
IDispatch*
Document, [in,out]
VARIANT*
Cancel);
Description: Called before document is closed (may
be canceled).
Every time before a user closed a document the
OnActivationChange
event is raised. The event allows you to override the
default behavior for the control and supply your own
custom actions and dialog boxes to do normal file
operations.
HTML + JScript
<script
language="JScript" for=EDrawOfficeViewer1 event="
BeforeDocumentClosed
(Document,
Cancel)">
OnBeforeDocumentClosedEvent(GoingActive);
</script>
<script language=javascript>
function
OnBeforeDocumentClosedEvent
(GoingActive)
{
Alert(“Respond the Before Document Closed Event.”);
}
</script>
Before Document Saved Event
Event:
void
BeforeDocumentSaved([in]
IDispatch*
Document, [in]
BSTR
Location, [in,out]
VARIANT*
Cancel);
Description: Called before document is saved (may be
canceled).
Every time a user opens a new document or closes a
document the
OnActivationChange
event is raised. The event allows you to override the
default behavior for the control and supply your own
custom actions and dialog boxes to do normal file
operations.
HTML + JScript
<script
language="JScript" for=EDrawOfficeViewer1 event="
BeforeDocumentSaved(Document,
Location, Cancel)">
OnBeforeDocumentSavedEvent(GoingActive);
</script>
<script language=javascript>
function
OnBeforeDocumentSavedEvent
(Document,
Location, Cancel)
{
Alert(“Respond the Before Document Saved Event.”);
}
</script>
Print Preview Exit Event
Event:
void
OnPrintPreviewExit();
Description: Called when print preview is closed.
Every time a user closes the print preview the
OnPrintPreviewExit
event is raised. The event allows you to override the
default behavior for the control and supply your own
custom actions and dialog boxes to do normal file
operations.
HTML + JScript
<script
language="JScript" for=EDrawOfficeViewer1 event="OnPrintPreviewExit
()">
OnPrintPreviewExitEvent(GoingActive);
</script>
<script language=javascript>
function
OnPrintPreviewExitEvent
(GoingActive)
{
Alert(“Respond the Print Preview Exit Event.”);
}
</script>
Before Document Print Event
Event:
HRESULT
BeforeDocumentPrint();
Description: Called before print a document.
Every time before a user print a document the
OnActivationChange
event is raised. The event allows you to override the
default behavior for the control and supply your own
custom actions and dialog boxes to do normal file
operations.
HTML + JScript
<script
language="JScript" for=EDrawOfficeViewer1 event="
OnBeforeDocumentPrint(GoingActive)">
OnBeforeDocumentPrintEvent(GoingActive);
</script>
<script language=javascript>
function
OnBeforeDocumentPrintEvent(GoingActive)
{
Alert(“Respond the Before Document Print Event.”);
}
</script>
Mouse Event
Event:
HRESULT
OnWindowBeforeRightClick();
Description: Called before right click the
component.
Event: HRESULT OnWindowBeforeDoubleClick();
Description: Called before double click the
component.
Every time before a user click the component with right
key mouse the
OnWindowBeforeRightClick
event is raised. Every time before a user double click
the component the
OnWindowBeforeDoubleClick
event is raised. The event allows you to override the
default behavior for the control and supply your own
custom actions and dialog boxes to do normal file
operations.