如何使用JavaScript在Birt Reporting中设置属性(How do I set a property using javascript In Birt Reporting)

编程入门 行业动态 更新时间:2024-10-21 17:22:27
如何使用JavaScript在Birt Reporting中设置属性(How do I set a property using javascript In Birt Reporting)

我正在使用Birt Reporting和eclipse。

我有一个报告,我想要使用条形码。

我做的测试报告是带条形码的简单报告。

它具有以下属性“条码内容”是扫描时将显示的属性:

所以目前如果我扫描它的“rrrrrrr”

我想在用java脚本生成报告时更改此设置,所以我想设置属性“条码内容”。

我如何设置属性。 你在哪里把Java脚本放在元素中? (onPrepare,的onCreate,的OnRender)

I am using Birt Reporting and eclipse.

I have a report that I want to use a barcode in.

The test report that I made is a simple report with a barcode.

It has the following properties "Barcode Content" is the property that will be displayed when you scan it :

So currently if I scan it its "rrrrrrr"

I want to change this when the report generates with java script so I want to set the property "Barcode Content".

How do I set the property. Where do you put the java script in the element ? (onPrepare,onCreate,onRender)

最满意答案

如果您使用的是Birt报告,并且您需要条形码,我可以通过执行以下操作来解决问题。

Birt的条码(查看免费)位于此处: https : //code.google.com/archive/p/birt-barcode-extension/downloads

我在eclips论坛上发现它: https ://www.eclipse.org/forums/index.php/t/796573/

在zip文件中,您可以获得Design Jar文件以及Runtime jar。

要获得Birt中的条码元素,请将Design jar文件复制到您的birt安装文件夹中,在我的情况下,它是eclipse\plugins

现在在eclipse中,您将能够在您的调色板上看到一个新的条形码控件,您可以使用它。

在这里输入图像描述

创建一个新的报告变量。

在这里输入图像描述

将数据分配给包含数据的另一个元素的OnRender中的变量。

vars["MyBarcodeData"] = this.getValue();

现在您可以将一个条形码元素从调色板拖到您的报告中。 然后选择条形码类型,编码,然后条形码文本巫婆将成为您创建的报告参数。

在这里输入图像描述

双击参数获取代码。

在这里输入图像描述

点击确定,这应该是。 您可能需要设置条码的宽度和高度。

当您运行报告时,您在报告参数中分配的数据将被绑定到条形码上,并生成条形码。

希望这可以帮助别人。

If you are using Birt reporting and you need a barcode I got it working by doing the following.

The barcode (Looks free) for Birt is located here : https://code.google.com/archive/p/birt-barcode-extension/downloads

I found it on eclips forum : https://www.eclipse.org/forums/index.php/t/796573/

In the zip file you get your Design Jar files as well as Runtime jars.

To get a bar code element in Birt copy the Design jar file to you birt installation folder in my case it was eclipse\plugins

Now in eclipse you will be able to see a new barcode control on you palette that you can use.

enter image description here

Create a new report variable.

enter image description here

Assign data to the variable in the OnRender of another Element that contains your data.

vars["MyBarcodeData"] = this.getValue();

Now you can drag a bar code element from the palette to your report. And you select the barcode type, encoding and then the barcode text witch will be the report parameter that you created.

enter image description here

Double click on the parameter to get the code.

enter image description here

Click Ok and that should be it. Ps you might have to set the width and height of the bar code.

When you run the report the data that you assigned in your report parameter will be bound to the bar code and you bar code will be generated.

Hope this helps someone else.

更多推荐

本文发布于:2023-07-06 07:59:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1047603.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   属性   Birt   Reporting   JavaScript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!