0
我在伯特脚本新需要一些脚本帮助。 我想合并单元格行表格上的行创建,如果他们包含相同的数据。 例如,这台伯特 - 如何操纵行单元格onrowcreate
------- ------- -------
| id1 | 2 | 4 |
------- ------- -------
| id2 | 5 | 5 |
------- ------- -------
应该像
------- ------- -------
| id1 | 2 | 4 |
------- ------- -------
| id2 | 5 |
------- ------- -------
我发现一些例子,现在我可以基于行的数据,如换行背景onrowcreate:
if (this.getRowData().getExpressionValue(1) == "id1")
this.getStyle().backgroundColor = "red";
if (this.getRowData().getExpressionValue(1) == "id2")
this.getStyle().backgroundColor = "blue";
而另一个例子展示了如何合并单元格在表头beforeFactory:
importPackage(Packages.org.eclipse.birt.report.model.api);
elementFactory = reportContext.getDesignHandle().getElementFactory();
var mytable = reportContext.getDesignHandle().findElement("mytable");
var myheader = mytable.getHeader().get(0);
tcell = myheader.getCells().get(1).drop();
tcell = myheader.getCells().get(0);
tcell.setColumnSpan(2);
tcell.setRowSpan(1);
个
两个例子都做工精细,但我需要把它们合并前检查细胞是否有相同的数据,我可以做一些类似beforeFactory脚本的东西onrowcreate,也可以有不同的方式。
谢谢!
谢谢!它效果很好。我已经添加了第二个详细信息行,并为我的两个详细信息行设置了可见性条件,第一个在单元格值不同时可见,第二个在相等时可见。 – Stingo82