I
ivanm
In our application we want to create a controlled/modified instance of Word.
We want to handle events raised in Word, such as command bar button clicks,
in our .NET application and are interested in any tips on how we might do
this. So Word in this instance becomes purely a UI layer that raises
notifications; the business stuff takes place within managed code.
Our application is basically a document creation/editing system used by
brokers; when a document is 'saved' it is actually persisted to a file server
for later use. So Save in this instance isn’t going to show the users a save
dialog.
This is currently implemented using lots of COM Interop that performs
terribly. Communication with the calling app is done by placing messages into
the message queue (VBA code) and overriding WndProc to respond to these.
We’ve looked at using shared addins in VS2005 and Word 2003 addins in
VS2008. We can use the approach as outlined at
http://blogs.msdn.com/andreww/archi...ins-and-requestcomaddinautomationservice.aspx
to call a method within the addin via reflection. However attempting to
access the Events on the class returned by the
RequestComAddInAutomationService override returns no result. Invoking methods
and properties is fine, however attempting to use
GetType().GetEvent("buttonClicked") returns null, although buttonClicked is
defined on the object returned. There appears to be some problem in passing
delegate information between processes.
All of the addin code samples I've seen so far have got the event
handling/document processing implemented within the addin itself.
The only success we've had so far involves polling the
application.ComAddins["MyAddin"].Object and calling a method to return a
string (xml node serialised) to return the event on the top of the message
queue. We can wrap events around this so any client code of our
ControlledWordInstance class can use these.
Any suggestions would be appreciated.
We want to handle events raised in Word, such as command bar button clicks,
in our .NET application and are interested in any tips on how we might do
this. So Word in this instance becomes purely a UI layer that raises
notifications; the business stuff takes place within managed code.
Our application is basically a document creation/editing system used by
brokers; when a document is 'saved' it is actually persisted to a file server
for later use. So Save in this instance isn’t going to show the users a save
dialog.
This is currently implemented using lots of COM Interop that performs
terribly. Communication with the calling app is done by placing messages into
the message queue (VBA code) and overriding WndProc to respond to these.
We’ve looked at using shared addins in VS2005 and Word 2003 addins in
VS2008. We can use the approach as outlined at
http://blogs.msdn.com/andreww/archi...ins-and-requestcomaddinautomationservice.aspx
to call a method within the addin via reflection. However attempting to
access the Events on the class returned by the
RequestComAddInAutomationService override returns no result. Invoking methods
and properties is fine, however attempting to use
GetType().GetEvent("buttonClicked") returns null, although buttonClicked is
defined on the object returned. There appears to be some problem in passing
delegate information between processes.
All of the addin code samples I've seen so far have got the event
handling/document processing implemented within the addin itself.
The only success we've had so far involves polling the
application.ComAddins["MyAddin"].Object and calling a method to return a
string (xml node serialised) to return the event on the top of the message
queue. We can wrap events around this so any client code of our
ControlledWordInstance class can use these.
Any suggestions would be appreciated.