Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

Commented Unassigned: Crashes on XLWorkbook workbook = new XLWorkbook(); [9314]

$
0
0
Hello all. Apparently the no-nonsense way to use ClosedXML doesn't have enough nonsense in it. I'm crashing on the very first command it should use!

Attached is a picture of the error
Comments: ** Comment from web user: orangeman1990 **

aaand I didn't want to submit yet. I'm tired, it's 12:40am and I've been at this for a couple of hours. Here is my code:

```
[HttpPost]
public ActionResult ExportExcel()
{
var workbook = new XLWorkbook();
workbook.Worksheets.Add("Sample").Cell(1, 1).SetValue("Hello World");

// Prepare the response

Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("content-disposition", "attachment;filename=\"HelloWorld.xlsx\"");

// Flush the workbook to the Response.OutputStream
MemoryStream memoryStream = new MemoryStream();

workbook.SaveAs(memoryStream);
memoryStream.WriteTo(Response.OutputStream);
memoryStream.Close();

Response.End();

return RedirectToAction("KPIExport");
}
```


Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>