locked
Download Excel sheet from Server without Excel Installed RRS feed

  • Question

  • User-1717836200 posted

    HI All,

                 Is there any way to download Excel in local Machine through application from Server without Microsoft Office installed in Server?? Is there any way to achive this?? Thanks in advance..

    Thursday, November 14, 2013 5:30 AM

Answers

  • User-837620913 posted

    Do you already have the Excel file on the server? If so, just use Response.TransmitFile to send it to the user.

    If not, and you are trying to create an Excel file on the server without installing Excel and using the Primary Interop Assemblies (PIAs) - good for you that is a good thing to do!

    Unfortunately you probably won't like the answer.

    1. Use the OpenXML SDK and write code to create an Excel .xlsx file and download it to the user. Pros - free. Cons - not many good tutorials.

    2. Use a third party component to do the same thing. Pros - fast and (depending on which one you pick) good documentation. Cons - costs money.

    I've used Aspose before and they are a pretty good balance of money versus functionality. Softartisans also has one. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 14, 2013 5:45 AM

All replies

  • User-837620913 posted

    Do you already have the Excel file on the server? If so, just use Response.TransmitFile to send it to the user.

    If not, and you are trying to create an Excel file on the server without installing Excel and using the Primary Interop Assemblies (PIAs) - good for you that is a good thing to do!

    Unfortunately you probably won't like the answer.

    1. Use the OpenXML SDK and write code to create an Excel .xlsx file and download it to the user. Pros - free. Cons - not many good tutorials.

    2. Use a third party component to do the same thing. Pros - fast and (depending on which one you pick) good documentation. Cons - costs money.

    I've used Aspose before and they are a pretty good balance of money versus functionality. Softartisans also has one. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 14, 2013 5:45 AM
  • User-1225287840 posted

    Yes. You can using an ExcelPackage.

    http://excelpackage.codeplex.com/

    Thursday, November 14, 2013 5:48 AM
  • User-1717836200 posted

    Hi Darrell,

              can you please share some link..

    Thursday, November 14, 2013 7:37 AM
  • User-417640953 posted

    Hi JERRY_TP,

    Thanks for your response.

    Base on Darrell's opinions, I suggest you below links.

    # How to use the Response.TransmitFile to send excel file to users.

       http://stackoverflow.com/questions/2274780/download-xlsx-file-using-response-transmitfile

    # Using  OpenXML SDK to create an Excel .xlsx file.

       http://www.codeproject.com/Articles/371203/Creating-basic-Excel-workbook-with-Open-XML

    # Primary Interop Assemblies

       http://msdn.microsoft.com/en-us/library/aax7sdch(v=vs.110).aspx

     

    Hope this helps. Thanks.

    Best Regards!

    Monday, November 18, 2013 4:20 AM
  • User555306248 posted
    Response.Clear();
                Response.Buffer = true;
                Response.ContentType = "application/vnd.ms-excel";
                Response.AppendHeader("Content-Disposition:", "attachment; filename=MyExcel.xls");
                Response.Charset = "";
                System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
                System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
                divMatrix.RenderControl(oHtmlTextWriter);
                Response.Write(oStringWriter.ToString());
                Response.End();

    http://forums.asp.net/t/1442217.aspx

    http://forums.asp.net/t/1920859.aspx

    Monday, November 18, 2013 10:32 PM