Posted: 12/20/2011
Hello Everyone,
I am new to crystal reports. I am using ASP.net 3.5 with c#. Report is working fine. but export and next page navigation is not working. So i created one button and in its click event wrote a code as below,
string exportFileName = "Questionaswer.rpt"; string exportPath = "C:\\crystalreport1.pdf"; //where file will be exported string path = Server.MapPath("~/Quiz/Questionaswer.rpt"); ReportDocument crReportDocument = new ReportDocument(); crReportDocument.Load(path); ExportOptions crExportOptions; DiskFileDestinationOptions crDestOptions = new DiskFileDestinationOptions(); crDestOptions.DiskFileName = exportPath; crExportOptions = crReportDocument.ExportOptions; crExportOptions.DestinationOptions = crDestOptions; //Specify export destination type crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; // Specify the format in which you want to export (like .doc,.pdf etc) crExportOptions.ExportFormatType = ExportFormatType.CrystalReport; crReportDocument.Export();
but in export method the system.runtime.interopservices exception is coming. The path of report is from temp folder. also i have tried giving the permissions to the folder in which the pdf will be created.also given permissions to whole project. but no success.Please tell me how to solve this.
Thanks in Advance.