Export Crystal report to PDF

G

Guest

Hi,

Could any one give a sample example on how to export crystal report called
"MyReport.rpt" to PDF using Crystal Report !!?


Thanks
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

ReportDocument r = new ReportDocument( );
r.Load( reportURL );
// set the parameters/ the datasource, etc,etc
r.SetDataSource( GetaDataSet() );
r.ExportToDisk( ExportTypeFormat.PortableDocFormat , "path to file );
 
G

Guest

Thank U very mutch Ignacio and this code is working fine but I didn't using
the " r.SetDataSource( GetaDataSet() );" line of code because I don't know
what it does!!?
So does it add a new data to my Report file!!?
 
G

Guest

That line of code, that cited Ignacio, just bind your data to report to show
report content.
SetDataSource can take different data sources, including DataSet.
See MSDN for more details about this method

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
S

Stephan Bomholt

Ignacio said:
Hi,

ReportDocument r = new ReportDocument( );
r.Load( reportURL );
// set the parameters/ the datasource, etc,etc
r.SetDataSource( GetaDataSet() );
r.ExportToDisk( ExportTypeFormat.PortableDocFormat , "path to file );
Hi,

a little hint!

I had on some customer-pcs problems with this ExportToDisk(). Sometimes
i got error messages, that a process can´t start in the background.

After exporting the reports in a MemoryWriter and writing this stream to
a file, the problems a gone.

Greetings from germany

Stephan
 
G

Guest

This bit of code is good if I already have the report, do U know how can I
generate a new report with a name of my choice and set its parameters!!!?


Thanks Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top