Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do i load crystal reports without crystal reports viewer?
Posted
Updated 19-Nov-11 0:27am
v2
Comments
Akhil Palyala 8-Jun-17 2:17am    
Hi,
By using the given code page is not exporting to pdf..
staying on same page

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.

C#
using CrystalDecisions.CrystalReports.Engine;



protected void btn_Click( object sender, EventArgs e )
{
	try
	{
		// Get the report document
		ReportDocument report = new ReportDocument();

		// it was guessed that the .rpt file is under 'Reporting' folder of the project
		report.Load( Server.MapPath( "~/Reporting/report1.rpt" ) );
		
		// Stop buffering the response
		Response.Buffer = false;
		// Clear the response content and headers
		Response.ClearContent();
		Response.ClearHeaders();
	
		// Export the Report to Response stream in PDF format
		report.ExportToHttpResponse( ExportFormatType.PortableDocFormat, Response, false, "My Report");
	}
	catch( Exception ex )
	{
		// use any logic to show the error, e.g. label, messageBox..
	}
}


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
 
Share this answer
 
v4
This is not possible, you need the viewer to show the reports.
 
Share this answer
 
its not possiable. cryatal reoport must have report viewer.....................
 
Share this answer
 
If you dont want to add the crystal report viewer at deisgn time just add the report viewer dynamically using code behind
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900