Not all Office 12 Properties/Methods/etc available in ADX Interops?

Add-in Express™ Support Service
That's what is more important than anything else

Not all Office 12 Properties/Methods/etc available in ADX Interops?
 
Ole Andreas Ringdal


Guest


I'm working on an add-in for Word 2007, trying to customize the Document Inspector to programmatically remove hidden metadata and/or personal information. When using the default interops provided by ADX, I cannot find any WdRemoveDocInfoType enumeration in the interop, and neither can I find any RemoveDocumentInformation method of the Document class.

My solution was to add a reference to the "Microsoft Word 12.0 Object Library" (Microsoft.Office.Interop.Word) and use the methods, properties, objects, and enumerations there in order to accomplish my goal.

While I did find an acceptable and working solution to my predicament, can ADX please provide an explanation as to why not all methods, properties, and enumerations in the Office 12 object model are available in the default ADX Interops? Will they be accessible in future versions?

Windows XP, Visual Studio Professional 2005, Add-in Express Professional v3.4.

Kind regards,
Ole Andreas Ringdal
Posted 08 May, 2007 06:48:01 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Ole Andreas.

The fact is that version neutral PIAs are interop assemblies for Office 2000. That is why you don't see method and properties which have been introduced in Office 2007. Please use PIAs for Office 2007 to solve the issue.


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.
Posted 08 May, 2007 09:08:02 Top
Ole Andreas Ringdal


Guest


Hello, Sergey.

Thanks for the prompt reply (as always -- I'm very grateful for the support you and your team are giving).

So, if I understand you correctly, the "included/default" interops are, because they should work on any version of Office between 2000 and 2007, in fact the least common denominator for all Office versions, to use a mathematical term? Therefore, if I want to use any functionality added in Office 2002/XP and onwards, I should use the Office 2007 PIAs? (Or the latest PIAs for the appropriate Office version I'm coding for.)

If I opt to use the latest PIAs for my add-ins, should I remove the old ones from my projects? Or could this break any ADX-specific functionality so that I have to let the old ones remain included in the project?

Best regards,
Ole Andreas Ringdal
Posted 08 May, 2007 13:35:21 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Ole Andreas.

If you use version-neutral PIAs and need to access some version specific features, you can take advantage of the late binding (see the InvokeMember method of the System.Type class).


If I opt to use the latest PIAs for my add-ins, should I remove the old ones from my projects?

Yes.
Posted 10 May, 2007 08:05:11 Top
Ole Andreas Ringdal


Guest


Sergey,

If I do want to develop for Office 2007 exclusively, exactly how do I remove these old PIAs from my existing projects without breaking anything? Just simply delete the reference to the old PIAs and add references to the new ones? (I guess I also could, and I have just done so, copied over content from the old project to a new, do-not-use-version-neutral-PIAs project, and it works fine.)

I'm sorry, but what you said about late binding and the System.Type.InvokeMember method is a little above my programming skills. Before spending time to learn about this, are there any specific advantages to use that method?

What I have done so far, is that I've declared a new object of type "Word 2007" and set that equal to the default Word 2000 WordApp, like this:

Dim WdApp As Microsoft.Office.Interop.Word.Application = WordApp

And then used WdApp.<some method> to get to the newer-than-2000 functionality I wanted. But this seems a bit "messy", and I do believe that things will run smoother/faster if I could do without the creation of a new object. Will the "late binding and System.Type.InvokeMember" method work better than using it this way?
Posted 12 Jun, 2007 06:43:14 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Ole Andreas.

If I do want to develop for Office 2007 exclusively, exactly how do I remove these old PIAs from my existing projects without breaking anything? Just simply delete the reference to the old PIAs and add references to the new ones? (I guess I also could, and I have just done so, copied over content from the old project to a new, do-not-use-version-neutral-PIAs project, and it works fine.)

Yes, correct.

I'm sorry, but what you said about late binding and the System.Type.InvokeMember method is a little above my programming skills. Before spending time to learn about this, are there any specific advantages to use that method?

The advantage is you get one add-in that supports multiple versions of Office.

Dim WdApp As Microsoft.Office.Interop.Word.Application = WordApp

And then used WdApp.<some method> to get to the newer-than-2000 functionality I wanted. But this seems a bit "messy", and I do believe that things will run smoother/faster if I could do without the creation of a new object. Will the "late binding and System.Type.InvokeMember" method work better than using it this way?

You can use the WordApp property directly in add-in code.
As to the late binding, it works slower than early binding that you are currenly using.


Posted 12 Jun, 2007 09:18:56 Top