找回密码
 立即注册

QQ登录

只需一步,快速开始

yf182187239

中级会员

2

主题

10

帖子

870

积分

中级会员

积分
870

活字格认证

最新发帖
yf182187239
中级会员   /  发表于:2014-5-23 15:27  /   查看:10631  /  回复:13
这是.rdlx的
GrapeCity.ActiveReports.PageReport _reportDef = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(Server.MapPath("../") + "Reports/" + report + ".rdlx"));
            _reportDef.Report.DataSources[0].DataSourceReference = "";
            _reportDef.Report.DataSources[0].ConnectionProperties.DataProvider = "OLEDB";
            _reportDef.Report.DataSources[0].ConnectionProperties.ConnectString = string.Format(&quotrovider=Microsoft.Jet.OLEDB.4.0;Data Source={0};", Server.MapPath("../Data/NWind_CHS.mdb"));

            GrapeCity.ActiveReports.Document.PageDocument _reportRuntime = new GrapeCity.ActiveReports.Document.PageDocument(_reportDef);

请问如果实现.cs的区域报表在.aspx页面的导出

13 个回复

正序浏览
roger.wang
社区贡献组   /  发表于:2014-5-28 10:36:00
14#
回复 13楼yf182187239的帖子

nice

欢迎有问题开新帖沟通。
回复 使用道具 举报
yf182187239
中级会员   /  发表于:2014-5-28 10:19:00
13#
谢谢,关于导出的问题都已经解决!
回复 使用道具 举报
roger.wang
社区贡献组   /  发表于:2014-5-27 18:15:00
12#
谢谢您的分享,这个倒是没有想到,直接调用Web_Viewer1_LocateDataSource函数。

区域报表导出,也可用类似的方法。
请参考本版的置顶帖:《ActiveResports官方资源集合贴(更新日期 2014-4-28)》, 搜索导出。
回复 使用道具 举报
yf182187239
中级会员   /  发表于:2014-5-27 13:58:00
11#
非常感谢,已经成功。Ps:直接调用Web_Viewer1_LocateDataSource也可,不用再加一层。

附:区域报表是否也可用这种方法导出?
ActiveReportsDemo.Reports.ZXJJYZXS rpt1 = new ActiveReportsDemo.Reports.ZXJJYZXS();

GrapeCity.ActiveReports.Document.SectionDocument _reportRuntime = new GrapeCity.ActiveReports.Document.SectionDocument("");

这个和PageDocument()参数不一致,是否是通过其他方法绑定的呢?
回复 使用道具 举报
roger.wang
社区贡献组   /  发表于:2014-5-27 12:28:00
10#
回复 9楼yf182187239的帖子

在导出Excel的时候,LocateDataSource调用的顺序见下图:

本帖子中包含更多资源

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

x
回复 使用道具 举报
yf182187239
中级会员   /  发表于:2014-5-27 09:32:00
9#
您好,您给的Demo和我的代码实现原理基本一样,都是可以实现报表的赋值和导出的,现在的问题是在btn_Excel_OnClick事件中给报表实例赋值时不执行赋值方方法,代码如下:
protected void btnExcel_Click(object sender, EventArgs e)
        {
            GrapeCity.ActiveReports.PageReport _reportDef = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(Server.MapPath("../") + "Reports/1.rdlx"));
            _reportDef.Document.LocateDataSource += WebViewer1_LocateDataSource;
            GrapeCity.ActiveReports.Document.PageDocument _reportRuntime = new GrapeCity.ActiveReports.Document.PageDocument(_reportDef);

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

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

            Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            Response.AddHeader("content-disposition", Server.UrlPathEncode("attachment;filename=客户订单.xlsx"));
            Response.BinaryWrite(ms.ToArray());
            Response.End();
        }
回复 使用道具 举报
roger.wang
社区贡献组   /  发表于:2014-5-26 17:42:00
8#
回复 7楼yf182187239的帖子

我找了一个demo:
可以WebViewer1.LocateDataSource、前台导出


运行需要加载AR V8的dll

参考博客:http://blog.gcpowertools.com.cn/ ... urce_SubReport.aspx

本帖子中包含更多资源

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

x
回复 使用道具 举报
yf182187239
中级会员   /  发表于:2014-5-26 13:54:00
7#
您好,已经上传测试的页面代码,开发环境是win2008R2+vs2010+IE8。

我用的Demo中的后台导出的代码是有Txt和CSV的,为什么JS导出不支持呢?

本帖子中包含更多资源

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

x
回复 使用道具 举报
roger.wang
社区贡献组   /  发表于:2014-5-26 11:54:00
6#
1 GetViewModel 这个是AR前端的方法,自带的,如2#的demo中用到了。  请上传一下您用到的代码,另外,您用的浏览器版本告之。
2 ExportType支持类型:Html、Image  、None 、Pdf、Word  、Xls、Xml
   参考自帮助文档:GrapeCity.ActiveReports.Viewer.Win.v8 Assembly > GrapeCity.Viewer.Common.Model Namespace : ExportType Enumeration
3 同问题1,我需要分析一下您的代码。
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部