Accessing document properties from within a custom document inspector

G

greba

I've followed the instructions on http://msdn2.microsoft.com/en-us/library/aa338203.aspx
and I can get the sample to work, however when I try and extend it to
reading document properties of the document it doesn't work.

If I have the following piece of code in either my Inspect or Fix
functions (from the IDocumentInspector interface), then the variable
docProps is null. Doc is the first argument passed into the function.

Microsoft.Office.Core.DocumentProperties docProps =
((Microsoft.Office.Interop.Word._Document)Doc).CustomDocumentProperties
as Microsoft.Office.Core.DocumentProperties;

The same piece of code in a different C# add-in sets docProps to a non-
null value, and allows access to the document's custom properties.

What am I doing wrong?

Thanks for the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top