0

I have inserted data into a dummy excel file. I have saved it on a temp folder of my web application. Now I want to download this file to the downloads folder from browser using ClosedXML. I have excel file path of my excel. All i need to download this excel from browser by using that file path.

Here is my last lines of code :

string excelFilePath = HttpContext.Current.Server.MapPath("~").Replace("\\", "/") + "SummaryOutputExcel.xlsx";
worksheet.Workbook.SaveAs(excelFilePath);
workbook.Dispose();
  • 2
    Possible duplicate of [Download file with ClosedXML](http://stackoverflow.com/questions/22296136/download-file-with-closedxml) – Raidri Sep 19 '16 at 11:42
  • Hello Raidri, I have tried the methods mentioned over there but getting unexpected errors. So it would be great if you ca provide some another solution.Thanks – Avnish Sharma Sep 19 '16 at 12:09
  • I don't understand the question. ClosedXML is a 3rd party library to generate an Excel file. It doesn't download anything. – Francois Botha Sep 20 '16 at 08:36
  • Hi, Francois Botha, by the library ClosedXML, i meant to use its xlworkbook object to use for downloading the file. That's why I have mentioned ClosedXML over there. Although I am using a webmethod just above my function thus httpcontext is not working for me. Please help me. – Avnish Sharma Sep 20 '16 at 09:43
  • I don't know much about that, but you'll get better answers if you remove the ClosedXML and excel-interop tags and add appropriate tags to your question. The current tags are misleading. To be honest, if I look at the other questions you've posted, you really have to put a bit more effort into your questions. See http://stackoverflow.com/help/how-to-ask – Francois Botha Sep 21 '16 at 08:08
  • Thanks Francois, I have the content from the link you have mentioned in above comment & I will try to ask question by keeping that in mind. – Avnish Sharma Sep 21 '16 at 08:45

0 Answers0