找回密码
 立即注册

QQ登录

只需一步,快速开始

2293174034
初级会员   /  发表于:2015-4-25 08:22:00
11#
在测试中ViewerType类型为AcrobatReader时显示的报表效果较好
回复 使用道具 举报
frank.zhang
社区贡献组   /  发表于:2015-4-27 18:04:00
12#
您好,
为了避免程序验证的复杂度。我们先在普通的ASP程序中实现了上述功能。


本帖子中包含更多资源

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

x
回复 使用道具 举报
2293174034
初级会员   /  发表于:2015-4-28 15:42:00
13#
您好,
我在Microsoft Visual studio C# 2012+Asp.Net MVC4+ActiveReports+视图引擎Razor环境下作了一个小实例,
实例地址 http://pan.baidu.com/s/1eQvT370
主要问题如下:AcrobatReader类型报表预览效果较好
1、个人表40条记录无法分页,只显示第一页,如何处理?;
2、导出excel在aspx下是通过服务器端响应文件流方式处理的,在cshtml(Razor环境)下如何实现?
3、是否可以实现客户端直接导出excel\保存pdf\打印?
     比如在预览时打印按钮功能直接调用ActiveReportsWeb:WebViewer工具栏上的print按钮,保存pdf直接调用ActiveReportsWeb:WebViewer工具栏上的保存按钮。
4、HtmlViewer类型报表预览效果变型(实例中的花名册)?
5、FlashViewer类型报表无法预览?
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-4-28 16:48:00
14#
回复 13楼2293174034的帖子

问题正在处理中,稍后给您回复。
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-4-28 17:20:00
15#
回复 13楼2293174034的帖子

第一个问题,我这边的预览结果是:


已经分页了,是否是你希望的效果?

本帖子中包含更多资源

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

x
回复 使用道具 举报
2293174034
初级会员   /  发表于:2015-4-28 17:31:00
16#
这是花名册可以分页,
单个人登记表只能显示第一个人的信息?
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-4-28 17:34:00
17#
回复 13楼2293174034的帖子

问题2 “导出excel在aspx下是通过服务器端响应文件流方式处理的,在cshtml(Razor环境)下如何实现?”

可以在 Controller 中添加Action 方法如下:
前台页面:

  1. <ul>
  2.     <li>@Html.ActionLink("Export Report", "Export")</li>   
  3. </ul>
复制代码


Controller 方法:

  1.         public void Export()
  2.         {
  3.             ReportClass model = new ReportClass();
  4.             Reports.SectionReport1 s_report = new Reports.SectionReport1();
  5.             s_report.Run();

  6.             System.IO.MemoryStream ms = new System.IO.MemoryStream();
  7.             GrapeCity.ActiveReports.Export.Excel.Section.XlsExport xlsExport1 = new GrapeCity.ActiveReports.Export.Excel.Section.XlsExport(); xlsExport1.FileFormat = GrapeCity.ActiveReports.Export.Excel.Section.FileFormat.Xlsx;
  8.             xlsExport1.Export(s_report.Document, ms);

  9.             Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  10.             Response.AddHeader("content-disposition", Server.UrlPathEncode("attachment;filename=Test1.xlsx"));
  11.             Response.BinaryWrite(ms.ToArray());            
  12.         }
复制代码
回复 使用道具 举报
2293174034
初级会员   /  发表于:2015-4-29 10:10:00
18#
上面这种方法导出的Excel报表,效果很差,
无法显示报表中的表格线及背景色等格式
回复 使用道具 举报
2293174034
初级会员   /  发表于:2015-4-29 10:17:00
19#
下面的方法在aspx下效果还可以,单在cshtml下导出时有错误提示 the data returned by LocateDataSource are null

_reportdata2 = GzxxData.GetRyjbxxs();
                    GrapeCity.ActiveReports.PageReport _reportDef = new GrapeCity.ActiveReports.PageReport(new FileInfo(Server.MapPath(&quot;/Reports/ryb/pyrydjb.rdlx&quot;)));
                                       
                    ((PageReport)(_reportDef)).Document.LocateDataSource += Document_LocateDataSource2;
                    _reportDef.Run();
                    GrapeCity.ActiveReports.Document.PageDocument _reportRuntime = new GrapeCity.ActiveReports.Document.PageDocument(_reportDef);

                    // Create an output directory
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();

                    // Provide settings for your rendering output.
                    GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtensionSettings
                    excelSetting = new GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtensionSettings();
                    excelSetting.FileFormat = GrapeCity.ActiveReports.Export.Excel.Page.FileFormat.Xlsx;
                    excelSetting.MultiSheet = false;
                    GrapeCity.ActiveReports.Extensibility.Rendering.ISettings setting = excelSetting;

                    //Set the rendering extension and render the report.
                    GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtension
                    excelRenderingExtension = new
                    GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtension();
                    GrapeCity.ActiveReports.Rendering.IO.MemoryStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.MemoryStreamProvider();
                    _reportRuntime.Render(excelRenderingExtension, outputProvider, excelSetting.GetSettings());
                    
                    //outputProvider.GetPrimaryStream().OpenStream().CopyTo(ms);
                    //return File(ms.ToArray(), &quot;application/vnd.ms-excel&quot;, Url.Encode(&quot;ryjbxx.xlsx&quot;));
                    Response.ContentType = &quot;application/vnd.ms-excel&quot;;
                    Response.AddHeader(&quot;content-disposition&quot;, &quot;inline;filename=客户订单.xlsx&quot;);
                    outputProvider.GetPrimaryStream().OpenStream().CopyTo(ms);
                    Response.BinaryWrite(ms.ToArray());
                    Response.End();
回复 使用道具 举报
frank.zhang
社区贡献组   /  发表于:2015-4-29 12:06:00
20#
您好,
我们怀疑是这个方法没有能够进去,导致的数据集是空的。
Document_LocateDataSource2
您可以打断电尝试下。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部