locked
developping an .net app which can work on office 2003 , 2007 and 2010 RRS feed

  • Question

  • Hi Techies ,

    I have an application which generates excel, word and power point documets from a .net winform application. This was working well on clients with office 2003 application. To support office 2007 the same solution is complied with office 2007 interop assemblies and a seperate set-up is distributed to clients with office 2007 (eventhough we dont use any office 2007 new features). Now office 2010 is in market and I am asked to support this too. Now my question is since higher version of office supports lower versions , cant we have a single code and a office 2003 interop assemblies which works on all office versions. My applcation is using very basic features of office 2003 and it does not need any other features of office 2007 or office 2010.

    Please guide me if this is possible , any links on this topic will be greatly appriciated.

    Thanks,

    Manjunatha

    Thursday, October 14, 2010 10:38 AM

Answers

  • Hi Manjunatha

    <<Yes we tested this on machines with Office 2007 and Office 2010. Not every thing breaks , Excel creation and some word file generation works fine. When there are some macros to be embeded,templates and power point to be created  it throws generic COM error .

    What we are wondering is when we can open and edit office 2003 docs and save them as office 2003 compatible documents in office 07 & office 2010 , then why the code should break?.>>

    I'm afraid, without details of the code AND the errors you're getting, it's not possible to offer any opinion about what might be going on, and how it could be remedied.

    About the only thing that occurs to me is that you're using C# code and this doesn't take into account the fact that the SaveAs method probably has additional, optional parameters in the newer versions. And C# definitely does not like that. Short of upgrading to Visual Studio 2010 and the .NET Framework 4.0 (where C# supports optional parameters), using VB.NET, or switching to late-binding for these calls, there's not much you can do.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Bessie Zhao Thursday, October 21, 2010 9:43 AM
    Monday, October 18, 2010 3:56 PM

All replies

  • Hi Manjunatha

    Have you ever tested whether your application will run on a machine with the newer version (whether 2007 or 2010) installed? The Office 2007 PIAs and the Office 2010 PIAs should "remap" something compiled with the Office 2003 PIAs. (If you open the project in Visual Studio you'll get errors in the references, but that's something different than installing and running.)

    A general answer to your question is that, if you upgrade to Visual Studio 2010 and the .NET Framework 4.0 you can embed the parts of the object model you use into your application. This will make it version-independent.

    Other than that, you'd need to remove the references to the PIAs and change your code to late-binding.


    Cindy Meister, VSTO/Word MVP
    Friday, October 15, 2010 8:53 AM
  • Hi Cindy Meister,

    Thanks for responding to this thread.

    Yes we tested this on machines with Office 2007 and Office 2010. Not every thing breaks , Excel creation and some word file generation works fine. When there are some macros to be embeded,templates and power point to be created  it throws generic COM error .

    What we are wondering is when we can open and edit office 2003 docs and save them as office 2003 compatible documents in office 07 & office 2010 , then why the code should break?.

    Thanks for your pointers to VS 2010 and late-binding. Any links to articles which shows how to build office version indipendent applications will be of great help.

    Thanks ,

    Manjunatha

    Monday, October 18, 2010 6:32 AM
  • Hi Manjunatha

    <<Yes we tested this on machines with Office 2007 and Office 2010. Not every thing breaks , Excel creation and some word file generation works fine. When there are some macros to be embeded,templates and power point to be created  it throws generic COM error .

    What we are wondering is when we can open and edit office 2003 docs and save them as office 2003 compatible documents in office 07 & office 2010 , then why the code should break?.>>

    I'm afraid, without details of the code AND the errors you're getting, it's not possible to offer any opinion about what might be going on, and how it could be remedied.

    About the only thing that occurs to me is that you're using C# code and this doesn't take into account the fact that the SaveAs method probably has additional, optional parameters in the newer versions. And C# definitely does not like that. Short of upgrading to Visual Studio 2010 and the .NET Framework 4.0 (where C# supports optional parameters), using VB.NET, or switching to late-binding for these calls, there's not much you can do.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Bessie Zhao Thursday, October 21, 2010 9:43 AM
    Monday, October 18, 2010 3:56 PM