如何动态改变BIRT报表元素的属性
有用过BIRT的同志么,急啊 --------------------编程问答-------------------- 百灵报表之使用Event Handler动态改变报表元素的属性Step 1: 打开Java Prospective
Step 2: 创建Java Project
Step 3: 编写Event Handler
import org.eclipse.birt.report.engine.api.script.IReportContext;
import org.eclipse.birt.report.engine.api.script.element.IDataItem;
import org.eclipse.birt.report.engine.api.script.eventhandler.IDataItemEventHandler
import org.eclipse.birt.report.engine.api.script.instance.IDataItemInstance
public class Script_DataItemEventHandler implements IDataItemHandler
{
public void onPrepare( IDataItem dataItem,
IReportContext reportContext )
{
}
public void onCreate( IDataItemInstance dataItemInstance,
IReportContext reportContext )
{
}
public void onRender( IDataItemInstance dataItemInstance,
IReportContext reportContext )
{
String value = (String) dataItemInstance.getValue( );
if ( value.equals( “sample” ) )
dataItemInstance.getStyle( ).setBackgroundColor( “Fuchsia” );
}
Public void onPageBreak( IDataItemInstance dataItemInstance,
IReportContext reportContext )
{
}
}
Step 4: 打开Report Design Prospective
Step 5: 创建Report Project
Step 6: 创建Report
Step 7: 创建data
Column Binding Name: data
Display Name: data
Data Type: Any
Expression: "sample"
Step 8: 选择data -> Property Editor -> Properties -> Event Handler
Step 9: 引用编译后的Script_DataItemEventHandler
Step 10: 点击 Preview 预览结果
百灵报表问题解答请浏览http://www.actuatechina.com/index.php
--------------------编程问答-------------------- 感谢,救急了
补充:企业软件 , 中间件