Office Interop after ADX upgrade

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

Office Interop after ADX upgrade
 
nir zamir


Guest


Hi,

I upgraded to ADX 2007, and updated the Office Interops references in my projects (I took them from a new version-neutral project I created after the upgrade).

However, some Excel API functions seemed to be modified. For example, Excel.PivotCache.CreatePivotTable now gets only 3 arguments and not 4 (in my case this is critical since I want to specify the pivot table version). Same goes for Excel.Workbook.Open.

Is it because I took the dll from the version-neutral project?
Can I use my old Office interops and still support Excel 2007?

Thanks,
Nir
Posted 18 Apr, 2007 11:50:30 Top
nir zamir


Guest


I've investigated a little more.

Indeed, the Office API has been modified since I was using version-neutral Office PIAs.

However, if I use non-neutral PIAs, I don't have access to other things, like Microsoft.Office.Core.CommandBars.

What can I do about it?

THanks,
Nir
Posted 19 Apr, 2007 07:58:08 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Nir.

The 'version-neutral' PIAs are interop assemblies for Office 2000.
You can use them if you need to support Office 2000 and above.
However, if the target Office versions are 2003 and 2007, I would advise you to use PIAs for Office 2003.


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 19 Apr, 2007 09:09:02 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Nir, to access the CommandBars collection of the host application you can use the CommandBarsObj property of the add-in module.
To call properties/methods which have been introduced in Office later than 2000 you can use the Invoke method of the System.Type type.
Posted 19 Apr, 2007 09:24:16 Top
nir zamir


Guest


Hi Sergey,
Thanks.

Is it OK to use the PIAs I've been using before upgrading ADX? Do the (not version-nuetral) new Office/Excel PIAs offer a new functionality? Are they required for the add-in to work in Excel 2007?

Thanks,
Nir.
Posted 22 Apr, 2007 05:11:29 Top
nir zamir


Guest


Hi,

It seems that when using the PIAs I've been using so far (from ADX 2.7), there is an exception in ADXCommandBarPopupControlCollection.Add when running in Excel 2007 (which makes sense).

So, again, when replacing Office.dll to be the one from a not version-neutral project I created with ADX 3.2 (IS IT OK?), I get a build error:
The type 'Microsoft.Office.Core.CommandBars' is defined in an assembly that is not referenced. You must add a reference to assembly 'office, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'


I can also reproduce the error when addin this line to AddinModule.cs:
Microsoft.Office.Core.CommandBars cb = ExcelApp.CommandBars;


Please let me know which Office.dll version I should use and how I should solve the above.


p.s. Is there a place that documents everything needed when upgrading ADX?

Thanks,
Nir.
Posted 22 Apr, 2007 09:56:33 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Nir.

We have never changed our PIAs and the ADXCommandBarPopupControlCollection class doesn't depend on PIAs.
Which version of MS Office should the add-in support?

Posted 23 Apr, 2007 08:29:13 Top
nir zamir


Guest


it should support Office 2003 and up.

Note: the Office.dll that's added to a new project (that I tried using) is 400k while the one I've been using so far is 219K.
Posted 25 Apr, 2007 01:00:53 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Nir.

I suppose you have Office 2003 installed on the dev PC.
If so, please create a new add-in project with the 'Use Version-neutral Office PIAs' option unchecked and copy all interop assmeblies from the new project to the OfficePIAs directory of your project. Please let me know if the problem still exists.
Posted 25 Apr, 2007 09:37:19 Top
nir zamir


Guest


Hi Sergey,

Yes, I have Office 2003 installed on the dev PC, but I've tried running my plug-in on Office 2007 with non-version-neutral PIAs (as you said) but this way I can't compile my project anymore.
As I wrote before, the problem is reproducible in a new add-in project (non-neutral) when adding the following line:

Microsoft.Office.Core.CommandBars cb = ExcelApp.CommandBars;

Add the above line and try to compile...


Thanks,
Nir
Posted 25 Apr, 2007 10:58:42 Top