2011-08-03 212 views
2

我:如何在Java中使用Apache Poi取消隐藏Excel中的隐藏行?

import org.apache.poi.ss.usermodel.Row; 

if ((currentRow = sheet.getRow(currentDataRow)) == null) { 
      currentRow = sheet.createRow(currentDataRow); // Creates a new row. 
     } 

// How to un-hide currentRow ? 

currentRow是隐藏的,所以要取消隐藏使用此currentRow对象此行?

请帮忙.. !!

+0

'currentRow'是什么意思是隐藏的?另外,'currentRow'是一个'HSSF'还是'XSSF'对象? –

+0

在工作表中,我使用的所有行都是隐藏的! –

回答

3

看起来像它getRowStyle().setHidden():上getRowStyle

currentRow.getRowStyle().setHidden(false); 

更多信息。

+0

请为'org.apache.poi.ss.usermodel.Row'提出解决方案,我无法为ss类型行找到相同的函数。 –

+0

对于usermodel,看起来像是[* exact * same methods](http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/CellStyle.html#setHidden%28boolean%29)。 – OverZealous

+0

这是单元格样式而不是行样式。 currentRow.setHidden()不存在。 –

1

我有poi-3.7,这些方法也没有出现。

下载最新的一个POI-3.8-BETA4和row.setRowStye()和row.getRowStye()都存在

0

Row.getRowStyle():返回整行的单元格样式。大多数行不会有这些行,所以会返回null。

但是,您可以检查该行是否被row.getZeroHeight()隐藏,并使用row.setZeroHeight(false)显示行;

相关问题