Can anyone tell what this code is doing:
protected void btnExport_Click(object sender, EventArgs e)
{
// Get the report document
ReportDocument repDoc = getReportDocument();
// Stop buffering the response
Response.Buffer = false;
// Clear the response content and headers
Response.ClearContent();
Response.ClearHeaders();
try
{
// Export the Report to Response stream in PDF format and file name Customers
repDoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat,Response,true,"Customers");
// There are other format options available such as Word, Excel, CVS, and HTML in the ExportFormatType Enum given by crystal reports
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
ex = null;
}
Prabhu RajaPosted Oct 18, 2011, 6:23 AM
I have already given this code in your previous thread,
http://www.c-sharpcorner.com/Forums/Thread/143897/exporting-crystal-report.aspx
This code is used to Export your Report (Crystal Report) to downloadable PDF Format. in this Coding, repDoc.Export(); must be used to get your pdf file like
protected void btnExport_Click(object sender, EventArgs e)
{
// Get the report document
ReportDocument repDoc = getReportDocument();
// Stop buffering the response
Response.Buffer = false;
// Clear the response content and headers
Response.ClearContent();
Response.ClearHeaders();
try
{
// Export the Report to Response stream in PDF format and file name Customers
repDoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat,Response,true,"Customers");
// There are other format options available such as Word, Excel, CVS, and HTML in the ExportFormatType Enum given by crystal reports
repDoc.Export(); // download your pdf file to local computer.
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
ex = null;
}
Hemant KumarPosted Oct 18, 2011, 12:15 AM
The Code you have given is exporting the report into PDF file using the Response Class.
For More information click this links
http://social.msdn.microsoft.com/Forums/en-US/vscrystalreports/thread/2e6ba358-d88c-4e4f-8b93-f3ae92baeec1/
http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-export-pdf.htm
http://www.codeproject.com/KB/cs/Crystal_Report_Export.aspx