格式为excel时在BIRT中隐藏交叉表列 [英] hiding crosstab columns in BIRT when format is excel

查看:106
本文介绍了格式为excel时在BIRT中隐藏交叉表列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据某些条件隐藏两个交叉表列.我已经能够通过使用

I want to hide two of the crosstab columns based on some condition. I have been able to achieve it by using

 function onPrepareCell( cell, reportContext )
 if(some condition){
    if( cell.getCellID() == cell#){
    cell.getStyle().setDisplay("none");
    }
  }

在交叉表的onPrepare事件中.它在PDF,HTML格式下可以正常工作,但是当格式为Excel时,列不会被隐藏.我需要尽快完成此操作,请帮助

in the onPrepare event of cross tab. It works fine in PDF,HTML format but the columns are not getting hidden when the format is Excel. I need to get this done soon please help

推荐答案

我从BIRT交易所得到了答案,我将答案发布在这里,以便对其他人有帮助

I got the answer from BIRT exchange i am posting the answer here so that it may be helpful to others

在交叉表的onPrepare()事件中,您可以编写以下代码

In the onPrepare() event of crosstab you can write the code as given below

函数onPrepareCrosstab(crosstab,reportContext) {
如果(某些情况){ reportContext.getDesignHandle().getElementByID(ElementId#).setStringProperty("width","0px"); }

function onPrepareCrosstab( crosstab, reportContext ) {
if(some condition ){ reportContext.getDesignHandle().getElementByID(ElementId#).setStringProperty("width","0px"); }

}

此处,ElementId#是要隐藏的单元格的ID#.如您所见,我们还可以使用它动态改变单元格的宽度.

here ElementId# is the Id# of the cell you want to hide. As you can see we can also use this to change the width of the cell dymanically.

这篇关于格式为excel时在BIRT中隐藏交叉表列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆