找回密码
 立即注册

QQ登录

只需一步,快速开始

15919418962

中级会员

5

主题

14

帖子

639

积分

中级会员

积分
639

活字格认证

最新发帖

[已处理] 报表导出

15919418962
中级会员   /  发表于:2013-9-17 15:16  /   查看:4586  /  回复:3
在WebCharReport.aspx里的EXCEL导出报表时报
,是不是我后台数据绑定的问题,请求解

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

3 个回复

倒序浏览
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2013-9-17 17:10:00
沙发
请查看以下代码,添加了 _reportRuntime.LocateDataSource += new GrapeCity.ActiveReports.LocateDataSourceEventHandler(Document_LocateDataSource);

  1.     protected void btnExcel_Click(object sender, EventArgs e)
  2.     {
  3.         string path = Server.MapPath("rptSalesByCategory.rdlx");
  4.         GrapeCity.ActiveReports.PageReport rptPreview = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(path));
  5.         WebViewer1.LocateDataSource += new GrapeCity.ActiveReports.LocateDataSourceEventHandler(Document_LocateDataSource);
  6.             
  7.         WebViewer1.Report = rptPreview;
  8.         GrapeCity.ActiveReports.Document.PageDocument _reportRuntime = new GrapeCity.ActiveReports.Document.PageDocument(rptPreview);
  9.         _reportRuntime.LocateDataSource += new GrapeCity.ActiveReports.LocateDataSourceEventHandler(Document_LocateDataSource);

  10.         GrapeCity.ActiveReports.Export.Excel.Section.XlsExport XlsExport1 = new GrapeCity.ActiveReports.Export.Excel.Section.XlsExport();

  11.         System.IO.MemoryStream ms = new System.IO.MemoryStream();
  12.         XlsExport1.FileFormat = GrapeCity.ActiveReports.Export.Excel.Section.FileFormat.Xlsx;
  13.         XlsExport1.Export(_reportRuntime, ms);

  14.         Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  15.         Response.AddHeader("content-disposition", Server.UrlPathEncode("attachment;filename=客户订单.xlsx"));
  16.         Response.BinaryWrite(ms.ToArray());
  17.         Response.End();
  18.     }
复制代码
回复 使用道具 举报
Young
高级会员   /  发表于:2013-9-18 08:50:00
板凳
假如在SectionReport这种报表里实现excel,word,pdf等格式导出的话那么要怎样绑定数据呢
回复 使用道具 举报
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2013-9-18 09:07:00
地板
区域报表数据源是通过 SectionReports1.DataSource 来实现数据绑定的。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部