BIRT 表格的高亮显示

http://rockis.iteye.com/blog/549841

一,如何让表格行交叉高亮 , 表格的奇偶高亮
1. 选择Data Explore页签
2. 右键点Outline中的style,选择"New style"
3. 选中"Predefined Stype", 在下面的列表框中选种table-detail
4. 再选中Hightlights页签,点“Add”
5. conditions后面输入"row.__rownum % 2", Equals To, 0
6. 在下面的Background Color中输入需要高亮的表格行的背景色
7. 确定退出

二,如何设置报表的Theme
Script->Report Design->initialize
reportContext.getDesignHandle().setThemeName(...)

三:单元格高亮显示
参考: http://www.eclipse.org/forums/index.php/m/733399/
1. 选择Data Explore页签
2. 右键点Outline中的style,选择"New style"
3. 选中"Predefined Stype", 在下面的列表框中选种table-detail-cell
4. 再选中Hightlights页签,点“Add”
5. conditions后面输入: row["TaskCode"], Equals To, new String("ABC")或者直接"ABC"
6. 在下面的Background Color中输入需要高亮的表格行的背景色
7. 确定退出
Put the highlight rule on the detail row, not the table:
importPackage(Packages.org.eclipse.birt.report.model.api);
importPackage(Packages.org.eclipse.birt.report.model.api.elements);
importPackage(Packages.org.eclipse.birt.report.model.api.elements.structures); 


//delm = 
reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("QTYELEMENT");
elementFactory = reportContext.getDesignHandle().getElementFactory();
var mytable = 
reportContext.getDesignHandle().findElement("customReportTable");
var detailSlot = mytable.getDetail( );
var rowd = detailSlot.get( 0 );

var colbinds = mytable.getColumnBindings( );



hc = StructureFactory.createHighlightRule();
hc.setTestExpression("row[\"QUANTITYORDERED\"]");
hc.setValue1("30");
hc.setOperator("eq");
hc.setProperty(HighlightRule.BACKGROUND_COLOR_MEMBER, "blue");
phc = rowd.getPropertyHandle(StyleHandle.HIGHLIGHT_RULES_PROP);
phc.addItem(hc);

你可能感兴趣的:(birt)