FastReport中国社区FastReport联系电话 联系电话:023-68661681

FastReport VCL程序员手册:使用变量列表

来源:   发布时间:2021-05-18   浏览:次

FastReport VCL是用于Delphi,C ++ Builder,RAD Studio和Lazarus的报告和文档创建VCL库。它提供了可视化模板设计器,可以访问为30多种格式,并可以部署到云,网站,电子邮件和打印中。

近日,FastReport VCL更新至v6.9,在新版本中,在PDF更新中增加了对以下对象的并行表单支持:文本,替换和图片。相互之间形式中。同时修复了多个Bug问题。欢迎下载体验。(旁边向下按钮下载)

立即点击下载FastReport VCL v6.9最新版

变量的概念在相应的章节中进行了详细说明。让我们简短地提醒大家要点。

用户可以在报告中指定一个或多个变量。可以为每个变量分配一个值或表达式,当引用一个变量时将自动计算出该值或表达式。变量可以通过“数据树”窗口直观地插入到报表中。将变量用于复合表达式的别名非常方便,而复合表达式经常在报表中使用。

使用变量时,必须使用“ frxVariables”单元。变量由TfrxVariable类表示。

  TfrxVariable = class(TCollectionItem)
  published
    property Name: String; // Name of a variable
    property Value: Variant; // Value of a variable
  end;

变量列表由TfrxVariables类表示。它包含使用列表所需的所有方法。

  TfrxVariables = class(TCollection)
  public
    // Adds a variable to the end of the list
    function Add: TfrxVariable;

    // Adds a variable to the given position of the list
    function Insert(Index: Integer): TfrxVariable;

    // Returns the index of a variable with the given name
    function IndexOf(const Name: String): Integer;

    // Adds a variable to the specified category
    procedure AddVariable(const ACategory, AName: String; const AValue: Variant);

    // Deletes a category and all its variables
    procedure DeleteCategory(const Name: String);

    // Deletes a variable
    procedure DeleteVariable(const Name: String);

    // Returns the list of categories
    procedure GetCategoriesList(List: TStrings; ClearList: Boolean = True);

    // Returns the list of variables in the specified category
    procedure GetVariablesList(const Category: String; List: TStrings);

    // The list of variables
    property Items[Index: Integer]: TfrxVariable readonly;

    // Values of variables
    property Variables[Index: String]: Variant; default;
  end;

如果变量列表很长,则按类别将其分组很方便。例如,当具有以下变量列表时:

Customer name
Account number
In total
Total vat

可以用以下方式表示它:

Properties
  Customer name
  Account number
Totals
  In total
  total vat

有以下限制:

  • 至少必须创建一个类别
  • 类别构成数据树的第一层,变量构成第二层
  • 类别不能嵌套
  • 变量的名称在整个列表中必须是唯一的,而不是在类别中

如果您对FastReport感兴趣,欢迎加入FastReport QQ交流群:801349317

还想要更多吗?您可以点击阅读【FastReport报表2020最新资源盘点】,查找需要的教程资源。让人兴奋的是FastReport .NET正在慧都网火热销售中!>>查看价格详情

本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:FastReport控件中文网 [https://www.fastreportcn.com/]
本文地址:https://www.fastreportcn.com/post/3057.html

联系我们
  • 重庆总部 023-68661681
购买
  • sales@evget.com
合作
  • business@evget.com


在线
客服
微信
QQ 电话
023-68661681
返回
顶部