MartinKrans
Programmer
Hello,
My situation is the following:
I developed a Web Application in .NET in C#, displaying a Crystal Report through a CrystalReportViewer control. The .NET help says that since I'm using a Web Application to display the report, exporting is not possible directly, but you'd have to place a button in the Web App. and attach some code to it, which results in the report being exported on the Crystal Reports Engine on the server. There was also some sample code, which I altered a bit into the following:
01 using CrystalDecision.Shared;
02 using CrystalDecisions.CrystalReports.Engine;
03
04 private void Button1_Click(object sender, System.EventArgs e)
05 {
06 String fileName = "test.rtf";
07 ExportOptions exportOpts = new ExportOptions();
08 DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
09 exportOpts = Report.ExportOptions;
10 exportOpts.ExportFormatType = ExportFormatType.RichText;
11 exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
12 diskOpts.DiskFileName = fileName;
13 exportOpts.DestinationOptions = diskOpts;
14 Report.Export();
15 }
But when I try to run the code, I get two error messages at lines 07 and 14, saying:
"The type or namespace name 'Report' could not be found (are you missing a using directive or an assembly reference?)"
I haven't got a clue about what's wrong with the code, since Report.Export and Report.ExportOptions should be in the namespace CrystalDecisions.CrystalReports.Engine.ReportDocument, which I included at the top. Perhaps anyone can help me out? I use the official .NET release, version 7.0.9466 of the Development Environment and version 1.0.3705 of the .NET framework.
Thanks and greetings,
Martin Krans
My situation is the following:
I developed a Web Application in .NET in C#, displaying a Crystal Report through a CrystalReportViewer control. The .NET help says that since I'm using a Web Application to display the report, exporting is not possible directly, but you'd have to place a button in the Web App. and attach some code to it, which results in the report being exported on the Crystal Reports Engine on the server. There was also some sample code, which I altered a bit into the following:
01 using CrystalDecision.Shared;
02 using CrystalDecisions.CrystalReports.Engine;
03
04 private void Button1_Click(object sender, System.EventArgs e)
05 {
06 String fileName = "test.rtf";
07 ExportOptions exportOpts = new ExportOptions();
08 DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
09 exportOpts = Report.ExportOptions;
10 exportOpts.ExportFormatType = ExportFormatType.RichText;
11 exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
12 diskOpts.DiskFileName = fileName;
13 exportOpts.DestinationOptions = diskOpts;
14 Report.Export();
15 }
But when I try to run the code, I get two error messages at lines 07 and 14, saying:
"The type or namespace name 'Report' could not be found (are you missing a using directive or an assembly reference?)"
I haven't got a clue about what's wrong with the code, since Report.Export and Report.ExportOptions should be in the namespace CrystalDecisions.CrystalReports.Engine.ReportDocument, which I included at the top. Perhaps anyone can help me out? I use the official .NET release, version 7.0.9466 of the Development Environment and version 1.0.3705 of the .NET framework.
Thanks and greetings,
Martin Krans