Create PDF, Excel or Word File from Crystal Report from Code

Hi,

Some times when working with crystal report viewer you do not want to show the report to user in raw format but instead you want to pass on the report in PDF or other format without requiring user to do extra click. This can be done easily in Dot Net with the following code.

MyReport report = new MyReport();

DataSet ds = GetData();

report.SetDataSource(ds);

report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "ExportedReport");

 

If you want you can use different format for export like PDF, word, Excel by changing the ExportFormatType enumeration value.

 

Vikram


Share this post   Email it

Feedback

Posted on 10/1/2009 9:55:15 PM

I'm studying studying MCA. thank u

Posted on 12/12/2009 4:25:33 PM

this is good article.it helps a lot when a client want report in different format.
thanking you for this article.

Please post your comments:

Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 

Copyright © 2006 - 2010 Vikram Lakhotia