locked
Support for multiple versions of Excel with C# RRS feed

  • Question

  • Hi All,

    I need to implement a Winform application that can open, modify and save all versions and all type of excel files(2000-2010). Currently I am using late binding for this but it makes my application very slow.

    Is there any other way to achieve this?

    I have heard about PIA but not sure if that could support all file versions.

    Thanks


    Amit Bansal http://www.oops4you.blogspot.com/
    • Moved by Mike Dos Zhang Tuesday, September 14, 2010 2:01 AM vsto question (From:Visual C# Language)
    Thursday, September 9, 2010 12:07 PM

Answers

  • When you go for Primary Interop Assemblies , you could face 2 major problems,

    1.You have to make sure target version of MS Office installed on the machine which your application runs.

    2.Your application should dispose all unmanaged components properly.

    With PIA , i don't think you are going to have much performance again, it will add one more layer to actual API call. Each call will go through complex marshalling between managed and unmanaged types.

    The other option is using OleDBProvider ,here you just need to change the connection string for reading range of excel versions.

     

    • Proposed as answer by Amy Li Tuesday, September 14, 2010 7:44 AM
    • Marked as answer by Amy Li Thursday, September 16, 2010 1:20 AM
    Thursday, September 9, 2010 12:26 PM

All replies

  • When you go for Primary Interop Assemblies , you could face 2 major problems,

    1.You have to make sure target version of MS Office installed on the machine which your application runs.

    2.Your application should dispose all unmanaged components properly.

    With PIA , i don't think you are going to have much performance again, it will add one more layer to actual API call. Each call will go through complex marshalling between managed and unmanaged types.

    The other option is using OleDBProvider ,here you just need to change the connection string for reading range of excel versions.

     

    • Proposed as answer by Amy Li Tuesday, September 14, 2010 7:44 AM
    • Marked as answer by Amy Li Thursday, September 16, 2010 1:20 AM
    Thursday, September 9, 2010 12:26 PM
  • Hi Amit,

    How is this issue going on in your side? Have you solved the problem?

    Best Regards,
    Amy Li
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Proposed as answer by Harmvdp Wednesday, February 27, 2019 11:47 AM
    Tuesday, September 14, 2010 7:44 AM
  • Hi Amit,

    I will mark the answer for the thread. Any further questions, please feel free to follow up. Thank you!

    Best Regards,
    Amy Li
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Thursday, September 16, 2010 1:20 AM