Article information
Article relates to
Telerik Reporting v6.x
Created by
Chavdar, Telerik
Last modified
August 24, 2012
Last modified by
Steve, Telerik
void
ExportToPDF(Telerik.Reporting.Report reportToExport)
{
ReportProcessor reportProcessor =
new
ReportProcessor();
Telerik.Reporting.InstanceReportSource instanceReportSource =
Telerik.Reporting.InstanceReportSource();
instanceReportSource.ReportDocument = reportToExport;
RenderingResult result = reportProcessor.RenderReport(
"PDF"
, instanceReportSource,
null
);
string
fileName = result.DocumentName +
"."
+ result.Extension;
Response.Clear();
Response.ContentType = result.MimeType;
Response.Cache.SetCacheability(HttpCacheability.Private);
Response.Expires = -1;
Response.Buffer =
true
;
Response.AddHeader(
"Content-Disposition"
,
.Format(
"{0};FileName=\"{1}\""
"attachment"
fileName));
Response.BinaryWrite(result.DocumentBytes);
Response.End();
}
Sub
ExportToPDF(
ByVal
reportToExport
As
Telerik.Reporting.Report)
Dim
reportProcessor
New
ReportProcessor()
instanceReportSource
Telerik.Reporting.InstanceReportSource()
instanceReportSource.ReportDocument = reportToExport
result
RenderingResult = reportProcessor.RenderReport(
Nothing
)
fileName
String
= result.DocumentName +
+ result.Extension
Response.Clear()
Response.ContentType = result.MimeType
Response.Cache.SetCacheability(HttpCacheability.
Private
Response.Expires = -1
True
"{0};FileName="
"{1}"
""
, fileName))
Response.BinaryWrite(result.DocumentBytes)
Response.
End
()
Resources Buy Try