找回密码
 立即注册

QQ登录

只需一步,快速开始

KearneyKang 讲师达人认证 悬赏达人认证
超级版主   /  发表于:2020-5-29 18:18  /   查看:2886  /  回复:1
本帖最后由 KearneyKang 于 2021-12-17 12:13 编辑

ActiveReports现在拥有Web端报表设计器和桌面端报表设计器。Web端设计的报表和桌面端设计的报表都是一个.Rdlx的报表文件。

由于ActiveReports的Web端报表设计器拥有报表的主题选项,在设计报表时报表就自带有报表主题,但是桌面端报表设计器暂时没有主题选择,因此会存在在Web端设计的报表在桌面端展示的时候效果不一致。这个暂时乜办法解决,但是我们可以解决在自己新建的项目中使用Web端报表设计器展示效果不一致的问题。

Web端报表设计器的主题选择:

报表设计样式,使用默认的主题:Cordial.default.rdlx-theme

Web端报表设计器展示的最终样式:

在JSviewer项目中展示的样式

现在展示的结果跟Web端展示的结果不一致,这是由于新建的JSviewer的项目中没有引用对应主题
现在我们引用对应的主题:Cordial.default.rdlx-theme
主题文件在Web端报设计器的源文件中有,使用什么主题就放什么主题文件
跟报表文件放在同一路径下,并设置为"复制":

预览结果


如果你的项目中的Startup.cs的文件使用了“UseCustomStore”进行报表自定义的一些设置,你需要自己的单独进行一个配置,保证主题样式能够被找到,不然那就会丢失主题。


  1. using GrapeCity.ActiveReports;
  2. using GrapeCity.ActiveReports.Aspnet.Viewer;
  3. using Microsoft.Owin;
  4. using Owin;
  5. using System;
  6. using System.IO;
  7. using System.Reflection;
  8. using System.Web;
  9. using System.Web.Routing;

  10. [assembly: OwinStartup(typeof(JSViewerMVCApplication1.Startup))]

  11. namespace JSViewerMVCApplication1
  12. {

  13.     public class Startup
  14.     {
  15.         public static string EmbeddedReportsPrefix = "JSViewerMVCApplication5.Reports";
  16.         private static readonly DirectoryInfo ResourcesRootDirectory =
  17.             new DirectoryInfo(String.Format(@"{0}.\Reports", HttpRuntime.AppDomainAppPath)); //主题文件的访问路径;
  18.         public object GetReport(string P)//获取报表名称
  19.         {


  20.             PageReport rep = new PageReport();
  21.             string path = System.Web.Hosting.HostingEnvironment.MapPath("~/");
  22.             rep.Load(new FileInfo(@"" + path + "Reports/" + P));
  23.             return rep.Report;
  24.         }
  25.         public void Configuration(IAppBuilder app)
  26.         {
  27.             app.UseErrorPage();
  28.             app.UseReporting(config => config.UseFileStore(ResourcesRootDirectory));//文件路径配置
  29.             app.UseReporting(settings =>
  30.             {
  31.                 settings.UseCustomStore(GetReport);//使用该方法可以自定义进行属性的设置和调用
  32.                 settings.UseCompression = true;
  33.             });

  34.             RouteTable.Routes.RouteExistingFiles = true;
  35.         }
  36.     }
  37. }
复制代码


本帖子中包含更多资源

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

x

0 个回复

您需要登录后才可以回帖 登录 | 立即注册
返回顶部