none
Open an Excel file without Office installed on the server

    Pertanyaan

  • Hi,

    I have webpage in which I have a button. I am trying to open an excel file from a network location when clicked on a button, but we don't have office installed on the server. Since I am using Microsoft.office.interop.excel.dll , it was working on my local computer but when i host this on the server, it is throwing errror. Is there any way i can open an excel file without office installed. Below is the code I am using.

            Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
            excelApp.Visible = true;
            excelApp.Workbooks.Open("\\\\servername\\c$\\Data.xlsx");



    Selasa, 11 September 2018 17.20

Semua Balasan

  • Hi, this will open an excel file with the default associated application:

    System.Diagnostics.Process.Start(@"\\servername\c$\Data.xlsx");

    You can't use Microsoft.Office.Interop.Excel without having Microsoft office installed.

    Selasa, 11 September 2018 17.58
  • It is giving me access denied error. I have checked the security on the folder. evertything seems correct

    Selasa, 11 September 2018 18.11
  • Unfortunately, you can't use Microsoft.office.interop.excel.dll without office installed, and it's also not recommended to install office on server side. To manipulate excel on server, you'd better go for OpenXML or a 3rd party library, such as Free Spire.XLS which you can get from NuGet: https://www.nuget.org/packages/FreeSpire.XLS/.
    Rabu, 12 September 2018 01.59
  • Hi vinisha9,

    Thank you for posting here.

    Since your question is more related to office, you could post a new thread in Office forum for suitable support.

    https://social.msdn.microsoft.com/Forums/en-US/home?category=officedev&filter=alltypes&sort=lastpostdesc

    The Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Rabu, 12 September 2018 07.28