导航
  • 主页
  • C#综合技术
  • C#互联网桌面应用
  • AppLauncher
  • WinForm
  • WPF
  • 问答

C# Crystal Reports 如何導出pdf文件

ggygd 2005-12-08 03:36:49
C# Crystal Reports 如何导出pdf文件,请赐教
...全文
111 点赞 收藏 3
写回复
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
singlepine 2005-12-24
导出为PDF文件的示例代码如下:
myrpt.ExportOptions.ExportDestinationType=CrystalDecisions.Shared.ExportDestinationType.DiskFile;
myrpt.ExportOptions.ExportFormatType=CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
CrystalDecisions.Shared.DiskFileDestinationOptions opt=new CrystalDecisions.Shared.DiskFileDestinationOptions();
opt.DiskFileName=Server.MapPath(@"temp_RPT.pdf") ;
myrpt.ExportOptions.DestinationOptions=opt;
myrpt.Export();


string destFileName=Server.MapPath(@"temp_RPT.pdf");
FileInfo fi = new FileInfo(destFileName);
Response.Clear();
Response.ClearHeaders();
Response.Buffer = false;
Response.AppendHeader("Content-Disposition","attachment;filename=" + Server.UrlEncode(Path.GetFileName(destFileName)));
Response.AppendHeader("Content-Length",fi.Length.ToString());
Response.WriteFile(destFileName);
Response.Flush();
Response.End();

其中,myrpt是报表对象.
回复
feiyun0112 2005-12-08

DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
diskOpts.DiskFileName = sDestFile; //文件名

oRpt.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;

oRpt.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;

oRpt.ExportOptions.DestinationOptions = diskOpts;

oRpt.Export();
回复
ggygd 2005-12-08
help!
回复
发动态
发帖子
C#
创建于2007-09-28

10.4w+

社区成员

.NET技术 C#
申请成为版主
社区公告

全世界最好的语言,没有之一.