How to Export Crystal Report to PDF in ASP.Net using C#

How to Export Crystal Report to PDF format in asp.net.

We have already learned in older post how to create and bind crystal reports in asp.net.

Create and bind crystal reports in asp.net

Design a asp.net web form with crystalreportviewer along with a Button.

Export Crystal Reports to PDF format in asp.net

Export Crystal Reports to PDF format in asp.net

 

write below code on Button for export crystal reports to PDF in asp.net.

protected void Button1_Click(object sender, EventArgs e)
{
DataSet1.STUDENT_SELECTDataTable StuDT = new DataSet1.STUDENT_SELECTDataTable();
DataSet1TableAdapters.STUDENT_SELECTTableAdapter StuAdapter = new DataSet1TableAdapters.STUDENT_SELECTTableAdapter();

StuDT = StuAdapter.Select();
ReportDocument rept = new ReportDocument();

rept.Load(Server.MapPath(“~/CrystalReport.rpt”));
rept.SetDataSource((DataTable)StuDT);
CrystalReportViewer1.ReportSource = rept;

rept.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, @”E:\Meera.pdf”);
}

 

Export Crystal Reports to PDF format in asp.net

Export Crystal Reports to PDF format in asp.net

Leave a Reply

Your email address will not be published. Required fields are marked *

6 + 3 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">