请教高人:水晶报表的导出
我使用以下代码导出PDF(C#)
ExportOptions eptions = new ExportOptions();
DiskFileDestinationOptions dfd = new DiskFileDestinationOptions();
dfd.DiskFileName = "c:\\1.pdf";
eptions = reportDoc.ExportOptions;
eptions.DestinationOptions = dfd;
eptions.ExportDestinationType = ExportDestinationType.DiskFile;
eptions.FormatOptions = ExportFormatType.PortableDocFormat;
reportDoc.Export();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.WriteFile("c:\\1.pdf");
Response.Flush();
Response.Close();
System.IO.File.Delete("c:\\1.pdf");
结果异常:
无效导出选项。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: CrystalDecisions.CrystalReports.Engine.InvalidArgumentException: 无效导出选项。
源错误:
行 92: eptions.ExportDestinationType = xportDestinationType.DiskFile;
行 93: eptions.FormatOptions = ExportFormatType.PortableDocFormat;
行 94: reportDoc.Export();(异常)
行 95: Response.ClearContent();
行 96: Response.ClearHeaders();
源文件: c:\inetpub\wwwroot\testcrystalreport\webform1.aspx.cs 行: 94
还有报出以下异常不知道是什么原因?
异常:"文件 C:\\DOCUME~1\\MGH\\ASPNET\\LOCALS~1\\Temp\\temp_4f485cc7-1c45-451d-802d-a47dc83c3ca2.rpt 内出错:\n拒绝访问报表文件。其他程序可能正在使用它。"
但是以前使用同样的代码没有任何问题,请高人救命啊,谢谢!