ron vader
Posts: 8
Joined: 2006-08-28
|
I'm working on an ADX.NET addin for Word (2003). In my addin I'm maintaining a reference to the Word._Document object passed in as a parameter from the adxWordEvents_DocumentOpen event.
for example, I may have something like the following:
class MyWordDocument( Word._Document doc) {
Word._Document _document = doc;
}
private void adxWordEvents_DocumentOpen(object sender, object hostObj) {
myWordDocument( hostObj as Word._Document);
}
... you get the idea.
later when I refer to the Word._Document object in my class, the document object appears to no longer be valid. hence any reference to a property of that object (eg. _document.CustomDocumentProperties) yields an exception.
any help in this regard would be much appreciated. |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Hi Ron.
The fact is that ADX destroy all parameters of ADX event handlers itself (except of Outlook event handles). So you shouldn't store them somewhere in the add-in code. Please use the Documents collection of the Word Object Model to obtain and save the document you need.
P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found. |
|
ron vader
Posts: 8
Joined: 2006-08-28
|
thanks for the prompt reply Sergey,
any chance I could do a Marshal.AddRef() on the document object received from ADX and then release/destroy it myself once I'm done? |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Ron, I can't guarantee that it will work properly.
But you can test it if you wish. |
|