Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export report to pdf: what's wrong?

Status
Not open for further replies.

lutzs

Programmer
Oct 8, 2002
75
LU
Hi,

i will export a report (created with an ado.net Dataset)
to pdf. What's wrong in my code?

private void button1_Click(object sender, System.EventArgs e)
{
string exportFilePath = "c:\\exported.pdf";

crReportDocument = new ReportDocument();
crReportDocument.Load("c:\\CrystalReport1.rpt");

crDiskFileDestinationOptions = new DiskFileDestinationOptions();
crDiskFileDestinationOptions.DiskFileName = exportFilePath;

crExportOptions = crReportDocument.ExportOptions;
crExportOptions.DestinationOptions = crDiskFileDestinationOptions;

crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;

crReportDocument.Export();

}

The error message is:
An unhandled exception of type 'CrystalDecisions.CrystalReports.Engine.LogOnException'occurred in crystaldecisions.crystalreports.engine.dll
Additional information: Logon failed.


Can I load the CrystalReportViewer not the file path with the report?
>> crReportDocument.Load("c:\\CrystalReport1.rpt");

Thanks,
Stephanie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top