请选择 进入手机版 | 继续访问电脑版
 找回密码
 立即注册

QQ登录

只需一步,快速开始

Lenka.Guo 讲师达人认证 悬赏达人认证
超级版主   /  发表于:2022-3-2 16:40  /   查看:1687  /  回复:2
当用户设计报表时并添加新的报表控件,如文本框,属性窗口中会自动为文本框设置一些默认属性值。比如,新添加了文本框控件,默认的字体为 Airal,字体大小为10pt,然后很多报表模板有自己的规范需要将默认的文本框字体改为微软雅黑,字体大小修改为9pt。那么本文就来介绍如何通过设置来调整文本框的默认属性值。
报表项目模板报表控件模板是通用的报表模板,该模板将需要引入的控件都设置了报表属性。您可以在桌面设计器中创建报表控件模板,如想要统一设置所有的文本框字体为微软雅黑,可以添加一个文本控件,在模板报表中,设置相关字体。
除了样式属性设置,如字体名称,新添加的报表控件的位置和单位都可以预先设置好。



因此,可能想同时为英制和里面创建报表项目模板。如果你的应用程序的用户只使用单一单位系统,创建一个相应的报表模板是可以的。
ActiveReportsJS 支持两种报表类型RDL报表和页面报表,默认报表模板都是可以支持的。
您可能需要创建四类的报表模板:
  • RDL报表 英寸为单位
  • 页面报表 英寸为单位
  • RDL报表 厘米为单位
  • 页面报表 厘米为单位

一旦创建了报表模板,您可以在您的应用程序的代码中初始化一个如下形状的对象。ReportInfo 对象示例:
  1. const reportItemTemplates = {
  2.   imperialTemplates: [
  3.     cplImperialReportTemplateInfo, // Report Info for the Continuous Page Layout Report Items Template with imperial units
  4.     fplImperialReportTemplateInfo // Report Info for the Fixed Page Layout Report Items Template with imperial units
  5.   ],
  6.   metricTemplates: [
  7.     cplMetricReportTemplateInfo, //  Report Info for the Continuous Page Layout Report Items Template with metric units
  8.     fplMetricReportTemplateInfo // Report Info for the Fixed Page Layout Report Items Template with metric units
  9.   ]
  10. }
复制代码

例如,您可以在应用程序的静态资产文件夹中保存报表模板。如 React app 的public文件夹,初始化以下代码:
  1. const reportItemTemplates = {
  2.   imperialTemplates: [
  3.     {id: "cpl-template-imperial.rdlx-json"}, // URL of the Continuous Page Layout Report Item Template with imperial units
  4.     {id: "fpl-template-imperial.rdlx-json"} // URL of the Fixed Page Layout Report Item Template with imperial units
  5.   ],
  6.   metricTemplates: [
  7.     {id: "cpl-template-metric.rdlx-json"}, //  URL of the Continuous Page Layout Report Item Template with metric units
  8.     {id: "fpl-template-metric.rdlx-json"} // // URL of the Fixed Page Layout Report Item Template with metric units
  9.   ]
  10. }
复制代码

注意,您可能想使用单一的报表项目模板。因此报表模板中希望能够包含控件的默认属性的设置:
  1. const reportItemTemplates = {
  2.   imperialTemplates: [
  3.     {id: "default-template.rdlx-json"}, // URL of the Continuous Page Layout Report Item Template with imperial units
  4.   ]
  5. }
复制代码

报表设计器配置如果您使用的是 React 设计器构件,或者Angular 设计器组件或Vue设计器组件,您可以使用customInitTemplates 属性传递相关值。
  1. import { Designer } from "@grapecity/activereports-react";

  2. const reportItemTemplates = {
  3.   imperialTemplates: [
  4.     {id: "cpl-template.rdlx-json"}
  5.   ]
  6. }

  7. function App() {
  8.   return (
  9.     <div id="designer-host">
  10.       <Designer customInitTemplates={reportItemTemplates}  />
  11.     </div>
  12.   );
  13. }
复制代码

在纯JS 项目中,使用 GC.ActiveReports.ReportDesigner.Designer 构造函数接收设计器配置对象,作为第二个参数:
  1. var designer = new GC.ActiveReports.ReportDesigner.Designer(
  2.     "#designer-host",
  3.     { customInitTemplates: reportItemTemplates }
  4. );
复制代码



本帖子中包含更多资源

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

x

2 个回复

倒序浏览
wengMQ悬赏达人认证
银牌会员   /  发表于:2022-9-17 15:12:20
沙发
.net 版本的在线设计器有这种接口吗?
回复 使用道具 举报
Bella.YuanWyn认证
超级版主   /  发表于:2022-9-19 09:17:14
板凳
wengMQ 发表于 2022-9-17 15:12
.net 版本的在线设计器有这种接口吗?

您好,.net目前还没有,我们也反馈一下,看后面是否可以增加。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部