使用push模式导出crystal报表求助
提示
文件 C:\WINDOWS\TEMP\temp_b2250c97-49bf-485a-bead-f969b094cd87.rpt 内出错:拒绝访问报表文件。其他程序可能正在使用它
源程序如下:
private void Btn_export_Click(object sender, System.EventArgs e)
{ CrystalDecisions.Shared.DiskFileDestinationOptions DiskOpts = new CrystalDecisions.Shared.DiskFileDestinationOptions();
DS_AnnCorp = getDS(this.Ddl_YearSelect.SelectedItem.Text);
if (DS_AnnCorp.Tables[0].Rows.Count>0)
{
oRpt.SetDataSource(DS_AnnCorp);
oRpt.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
oRpt.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
DiskOpts.DiskFileName = "c:\\output.pdf";
oRpt.ExportOptions.DestinationOptions = DiskOpts;
try
{
oRpt.Export();
}
catch(System.Exception exportException)
{
this.Response.Write(exportException.Message);
}
}
else
{
this.Response.Write("<script language=\"javascript\">alert(\"数据错误,无法导出!\")</script>"
}
}