The EDraw Office Viewer Component provides some simple automation functions. You can call them directly. Or you can get the dispatch interface then do the automation by yourself.
Get Dispatch Interface to support the Office Automation
Description: Returns the Automation interface of the document object.
The control also supports a property called Dispatch that allows you to obtain a reference to the IDispatch interface of the embedded object. From this interface you can automate the object to perform tasks, edit parts of the document, or gather information about what a user has added or removed. For example, if you have a Word document open, you can use code that resembles the following to add a line of text:
<script language=”vbscript”>
Sub OfficeAutomationDemo()
OfficeViewer1.CreateNew “Word.Document”
Set objWord = OfficeViewer1.ActiveDocument
objWord.Content.Text = “This was added by Automation”
End Sub
</script>
or
<script language=”vbscript”>
Sub OfficeAutomationDemo()
OfficeViewer1.CreateNew “Word.Document”
Set objApp = OfficeViewer1.Application
objApp.DisplayScrollBars = False
End Sub
</script>
Leave a Reply
You must be logged in to post a comment.
Recent Comments