How to set the download file name
-
How do you set the download file name?
https://github.com/jsreport/jsreport-xlsx/issues/9
The strongly-typed .NET class does not have a definition for Content-Disposition.
-
Anyone?
-
Please share some code...
You should be able to setContent-Disposition
header in your c# code before you send the response back to the browser.
-
jsReportFeature.Recipe(Recipe.PhantomPdf).Configure(req => { req.Options. //ContentDisposition property is not there });
All there is
Base
,Debug
,Preview
,Reports
, andTimeout
.
-
This is part of the official asp.net core example.
[MiddlewareFilter(typeof(JsReportPipeline))] public IActionResult InvoiceDownload() { HttpContext.JsReportFeature().Recipe(Recipe.PhantomPdf) .OnAfterRender((r) => HttpContext.Response.Headers["Content-Disposition"] = "attachment; filename=\"myReport.pdf\""); return View("Invoice", InvoiceModel.Example()); }
-
Didn't know there was an official asp.net core example, thank you
-
You are welcome.
For the reference the links to docs and examples are here
https://jsreport.net/learn/dotnet
https://github.com/jsreport/jsreport-dotnet