none
C#.NET program on webserver needs to access Office applications RRS feed

  • Question

  • Problem:

    The issue is that we are not able to read/interpret from binary Excel 2003 and 2007 formatted documents via our custom .Net application that resides on a Windows 64-bit IIS webserver, unless the entire Microsoft Office suite is installed on the server to place the OLEDB libraries.


    Solution:

    Since Microsoft advises against automation on server based applications, we took the path of installing "Microsoft Access Database Engine 2010 Redistributable " from the below link. http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=13255.


    Questions:

    1. Are we in the right direction from Microsoft Point of view?
    2. If so, is this the right download/install?
    3. Can the OleDbConnection read from a Stream instead of specifying the file name in the connection string
    • Moved by Cindy Meister MVPModerator Friday, August 5, 2011 5:43 AM not using VSTO technology (From:Visual Studio Tools for Office)
    • Moved by Eddy Escardo-Raffo [MSFT] Saturday, August 6, 2011 2:37 AM this question has nothing to do with kinect SDK. Moving to General Office Development forum. (From:General Discussion—Kinect for Windows SDK)
    Friday, August 5, 2011 12:25 AM

Answers

  • Hi MMora789,

    >>1. Are we in the right direction from Microsoft Point of view?

    As far as I know, you are in the right direction, if the server installs the Office application and the Database Enginee 2010, you can use the OleDbConnection like this:

    OleDbConnection con;
    con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=source.xlsx;Extended Properties=Excel 12.0")

    >> 2. If so, is this the right download/install?

    It is right download and install.

    >>3. Can the OleDbConnection read from a Stream instead of specifying the file name in the connection string

    Based on my experience, there does not exist such a way through reading from the stream. It only provide the way through specifying the name of the file.

    Besides, here is a KB article for you to reference:

    http://support.microsoft.com/kb/247412  which introduces using OleDb to transfer data in Excel

    Hope this can help you and just feel free to follow up after you have tried.

    Best Regards, 


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Bruce Song Thursday, August 18, 2011 1:56 AM
    Monday, August 8, 2011 3:03 AM

All replies

  • Hi MMora789,

    >>1. Are we in the right direction from Microsoft Point of view?

    As far as I know, you are in the right direction, if the server installs the Office application and the Database Enginee 2010, you can use the OleDbConnection like this:

    OleDbConnection con;
    con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=source.xlsx;Extended Properties=Excel 12.0")

    >> 2. If so, is this the right download/install?

    It is right download and install.

    >>3. Can the OleDbConnection read from a Stream instead of specifying the file name in the connection string

    Based on my experience, there does not exist such a way through reading from the stream. It only provide the way through specifying the name of the file.

    Besides, here is a KB article for you to reference:

    http://support.microsoft.com/kb/247412  which introduces using OleDb to transfer data in Excel

    Hope this can help you and just feel free to follow up after you have tried.

    Best Regards, 


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Bruce Song Thursday, August 18, 2011 1:56 AM
    Monday, August 8, 2011 3:03 AM
  • Hi MMora789,

    How about the problem on your side? If you still need any assistant, just feel free to let us know.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, August 12, 2011 7:47 AM