请问C# WINFORM如何把水晶报表导出PDF文档
推荐于2016-03-05
展开全部
这是代码:private void pdfGenerate(DataTable dt,string strRptName)
{
CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc=new ReportDocument();
rptDoc.Load(this.Server.MapPath(strRptName + ".rpt"));
rptDoc.SetDataSource(dt);rptDoc.PrintOptions.PaperSize=PaperSize.PaperA4;
rptDoc.PrintOptions.PaperOrientation=PaperOrientation.Landscape;
CrystalDecisions.Shared.DiskFileDestinationOptions objFile=new DiskFileDestinationOptions();
objFile.DiskFileName=this.Server.MapPath(@"PDF\" + strRptName + "_" + this.Request.Cookies["cokYXSDM"].Value.Trim()+".pdf");
rptDoc.ExportOptions.ExportDestinationType=ExportDestinationType.DiskFile;
rptDoc.ExportOptions.DestinationOptions=objFile;
rptDoc.ExportOptions.ExportFormatType=ExportFormatType.PortableDocFormat;
rptDoc.Export();
}
{
CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc=new ReportDocument();
rptDoc.Load(this.Server.MapPath(strRptName + ".rpt"));
rptDoc.SetDataSource(dt);rptDoc.PrintOptions.PaperSize=PaperSize.PaperA4;
rptDoc.PrintOptions.PaperOrientation=PaperOrientation.Landscape;
CrystalDecisions.Shared.DiskFileDestinationOptions objFile=new DiskFileDestinationOptions();
objFile.DiskFileName=this.Server.MapPath(@"PDF\" + strRptName + "_" + this.Request.Cookies["cokYXSDM"].Value.Trim()+".pdf");
rptDoc.ExportOptions.ExportDestinationType=ExportDestinationType.DiskFile;
rptDoc.ExportOptions.DestinationOptions=objFile;
rptDoc.ExportOptions.ExportFormatType=ExportFormatType.PortableDocFormat;
rptDoc.Export();
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询