Last post Nov 18, 2013 10:32 PM by chetan.sarode
Nov 14, 2013 05:30 AM|JERRY_TP|LINK
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..
Nov 14, 2013 05:45 AM|DarrellNorton|LINK
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.
Nov 14, 2013 05:48 AM|sridhar_rs|LINK
Yes. You can using an ExcelPackage.
Nov 14, 2013 07:37 AM|JERRY_TP|LINK
can you please share some link..
Nov 18, 2013 04:20 AM|Fuxiang Zhang - MSFT|LINK
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.
# Using OpenXML SDK to create an Excel .xlsx file.
# Primary Interop Assemblies
Hope this helps. Thanks.
Nov 18, 2013 10:32 PM|chetan.sarode|LINK
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);