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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export with CrystalReportViewer in VS.net

Status
Not open for further replies.

lutzs

Programmer
Oct 8, 2002
75
LU
Hi,

i show an existing report with the crystalreportviewer.
There exist a button "export" to export the report.
But I will export the report to pdf automatically, without click the button.

I work with the sample report from Microsoft Visual Studio.net:
C:\Program Files\Microsoft Visual Studio.net\CrystalReports\Samples\Code\Winforms\C#\Simple.csproj

When I click the button "export" in the crystalreportviewer I get this error message:
"Error in file C:\Program Files\Microsoft Visual Studio.net\CrystalReports\Samples\Code\Winforms\C#\Simple.csproj
Operation not yet implemented"
"Export failed"
When I will export the file automatically with this code, I get this error message, too:
ReportDocument crReportDocument;
ExportOptions crExportOptions;
DiskFileDestinationOptions crDiskFileDestinationOptions;

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

crReportDocument = new ReportDocument();
crReportDocument.Load(@"C:\\Program Files\\Microsoft Visual Studio .NET\\Crystal Reports\\Samples\\Reports\\General Business\\Income Statement.rpt");

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

crExportOptions = crReportDocument.ExportOptions;
crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;

crReportDocument.Export();

MessageBox.Show("Report exported");
}
catch (Exception excp)
{
MessageBox.Show(excp.ToString());
}


When I open the .rpt with Crystal Reports I can export the report.

What's the problem?

Thanks,
Stephanie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top