找回密码
 立即注册

QQ登录

只需一步,快速开始

siberlee
金牌服务用户   /  发表于:2015-10-16 10:55  /   查看:4199  /  回复:6
你好!
我们软件现在有一个需求,就是同一张表批量导出Excel。我的实现方法是依次取数据加载模板,再导出。但是发现AR在导出Excel时应该是异步处理的,我在导出的过程中加上信号量等同步,也没能够处理。附件中是我做的一个示例,请帮我看看,或者有没有其它方法,谢谢!


本帖子中包含更多资源

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

x

6 个回复

倒序浏览
frank.zhang
社区贡献组   /  发表于:2015-10-16 14:28:00
沙发
您好,

run的方法中,提供了异步的模式,可以参考AR的文档(下载中带的CHM文件)
Run(Boolean) Starts report execution and optionally keeps any linked viewer control document in sync with the report's document.   
Run() Starts the report processing in blocked mode.   

调整了初始化的顺序
  1.         SectionReport1 report;
  2.         public MainWindow()
  3.         {
  4.             InitializeComponent();
  5.             report = new SectionReport1();
  6.             report.DataSource = getData();
  7.             report.DataMember = "Table";
  8.             report.Run(false);
  9.             this.MyView.LoadDocument(report);
  10.         }
复制代码

  1.                     GrapeCity.ActiveReports.Export.Excel.Section.XlsExport XlsExport1 = new GrapeCity.ActiveReports.Export.Excel.Section.XlsExport();
  2.                     XlsExport1.FileFormat = GrapeCity.ActiveReports.Export.Excel.Section.FileFormat.Xlsx;
  3.                     XlsExport1.Export(report.Document, strName);
复制代码


本帖子中包含更多资源

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

x
回复 使用道具 举报
siberlee
金牌服务用户   /  发表于:2015-10-16 15:27:00
板凳
回复 2楼frank.zhang的帖子

你好,例子程序是用的SectionReport,请问PageReport也有这个同步机制吗?如果有,怎么实现。
回复 使用道具 举报
frank.zhang
社区贡献组   /  发表于:2015-10-16 15:58:00
地板
您好,

目前没有RDL报表的例子程序,我可以给您制作一个例子程序,但是制作例子程序需要时间,我下周一给您回复。
回复 使用道具 举报
frank.zhang
社区贡献组   /  发表于:2015-10-19 11:37:00
5#
您好,

RDL导出程序在代码上和区域报表不同,Render是AR9最新的导出excel的方法,做了很多优化
可以参考:
  1.             GrapeCity.ActiveReports.PageReport report = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(@"..\..\RdlReport1.rdlx"));
  2.             GrapeCity.ActiveReports.Document.PageDocument reportDocument = new GrapeCity.ActiveReports.Document.PageDocument(report);

  3.             // Create an output directory
  4.             System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@".");
  5.             outputDirectory.Create();

  6.             // Provide settings for your rendering output.
  7.             GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtensionSettings excelSetting = new GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtensionSettings();
  8.             excelSetting.FileFormat = GrapeCity.ActiveReports.Export.Excel.Page.FileFormat.Xls;
  9.             GrapeCity.ActiveReports.Extensibility.Rendering.ISettings setting = excelSetting;

  10.             //Set the rendering extension and render the report.
  11.             GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtension excelRenderingExtension = new GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtension();
  12.             GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, name);
  13.             reportDocument.Render(excelRenderingExtension, outputProvider, excelSetting.GetSettings());
复制代码



本帖子中包含更多资源

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

x
回复 使用道具 举报
frank.zhang
社区贡献组   /  发表于:2015-11-9 17:42:00
6#
为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢

评分

参与人数 1满意度 +1 收起 理由
siberlee + 1 非常感谢

查看全部评分

回复 使用道具 举报
frank.zhang
社区贡献组   /  发表于:2015-11-12 14:26:00
7#
您好,

这个问题是否已经解决了呢?
我看您给我们的服务评价了1分,我们的服务是否有需要提高和改进的地方呢?

评分

参与人数 1满意度 +5 收起 理由
siberlee + 5 非常感谢您的耐心

查看全部评分

回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部