2011-08-03 211 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)顯示行;

相關問題