It's possible to show crystal report without crystal reports viewer. there have some other formats to show the report e.g. pdf, ms word etc.
Behind a button click event or any page load event use the code below to show crystal report on browser's pdf plug in.
Moreover, the print button of crystal report viewer does not work on client side. It's printing only on server side. so to show and print the document, its helpful to use pdf, ms word browser plug in.
using CrystalDecisions.CrystalReports.Engine;
protected void btn_Click( object sender, EventArgs e )
{
try
{
ReportDocument report = new ReportDocument();
report.Load( Server.MapPath( "~/Reporting/report1.rpt" ) );
Response.Buffer = false;
Response.ClearContent();
Response.ClearHeaders();
report.ExportToHttpResponse( ExportFormatType.PortableDocFormat, Response, false, "My Report");
}
catch( Exception ex )
{
}
}
Available formats to export
The report can be exported in different formats as follow:
ExportFormatType.PortableDocFormat | Portable Document Format (PDF) |
ExportFormatType.Excel | Complete Report to Excel |
ExportFormatType.ExcelRecord | Only Report Data to Excel |
ExportFormatType.HTML40 | HTML |
ExportFormatType.RichText | Rich Text Format (RTF) |
ExportFormatType.WordForWindows | MS Word |