Created
July 24, 2020 15:21
-
-
Save sitefinitysteve/7fd874150963a3e1ee4d0d91429b2bea to your computer and use it in GitHub Desktop.
/blog/code/2012/03/16/telerik-reporting--export-on-button-click
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ExportToPDF(Telerik.Reporting.Report reportToExport) | |
{ | |
ReportProcessor reportProcessor = new ReportProcessor(); | |
RenderingResult result = reportProcessor.RenderReport("PDF", reportToExport, null); | |
string fileName = result.DocumentName + ".pdf"; | |
Response.Clear(); | |
Response.ContentType = result.MimeType; | |
Response.Cache.SetCacheability(HttpCacheability.Private); | |
Response.Expires = -1; | |
Response.Buffer = true; | |
Response.AddHeader("Content-Disposition", | |
string.Format("{0};FileName=\"{1}\"", | |
"attachment", | |
fileName)); | |
Response.BinaryWrite(result.DocumentBytes); | |
Response.End(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment