我知道如何在交叉表或单元格in this question的“onprepare”事件中隐藏Excel Birt导出中的交叉表列。
我的问题是如何在“onPrepareCell”事件中访问单元格的数据值,例如,如果value =“EURO”将此单元格的宽度设置为0,如下所示:
columns = Entry.columns.map(&:name)
# => ["id", "dish_id", "name", "value"]
columns_to_update = columns - ["id"]
# => ["dish_id", "name", "value"]
columns_with_zero = columns_to_update.map { |c| [c, 0] }.to_h
# => {"dish_id"=>0, "name"=>0, "value"=>0}
Entry.update_all columns_with_zero
# UPDATE "entries" SET "dish_id" = 0, "name" = '0', "value" = 0
但我无法从IDataItem中提取值。
答案 0 :(得分:0)
我们无法访问dataItem onPrepareCell(cell,reportContext)
而是使用交叉表外部的Report参数
onPrepareCell(cell, reportContext){
if (reportContext.getParameterValue("CURRENCY") == "EURO") {
if (cell.getCellID() == cell#){
reportContext.getDesignHandle().getElementByID(ElementId#).setStringProperty("width", "0px");
}
}
}