使用ReportDesignHandle将文本设置为birt .rptdesign文件中的标签

时间:2015-08-14 21:46:24

标签: java birt

我正在尝试以编程方式填写可以移动的模板,然后将文件上传到我的程序。我一直在寻找一段时间,似乎只有旧的答案,旧的API允许这样一个简单的setText:

designHandle.findElement("ValueName").setText("text");

我还发现ITextItemInstance能够像我想的那样设置文本,但是它似乎只在创建新的标签实例时使用,而不是编辑现有标签。

我正在使用Birt 4.5.0

1 个答案:

答案 0 :(得分:0)

从书Integrating and Extending BIRT第296页:

//Access the label by name.
LabelHandle headerLabel = (LabelHandle) design.findElement("Header Label");
try {
headerLabel.setText("Updated " + headerLabel.getText());
} catch (Exception e) {
// Handle the exception
}

designReportDesignHandle个对象。

相关问题