2

I have:

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 is hidden, so to un-hide this row using this currentRow object?

Please help.. !!

Yugal Jindle
  • 44,057
  • 43
  • 129
  • 197

3 Answers3

5

Looks like it's getRowStyle().setHidden():

currentRow.getRowStyle().setHidden(false);

More info on getRowStyle.

OverZealous
  • 39,252
  • 15
  • 98
  • 100
  • Please suggest the solution for `org.apache.poi.ss.usermodel.Row`, I am not able to find the same function for the ss type row. – Yugal Jindle Aug 03 '11 at 08:01
  • Looks like it's the [*exact* same methods](http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/CellStyle.html#setHidden%28boolean%29) for usermodel. – OverZealous Aug 03 '11 at 08:05
  • That is the cell style and not the row style. currentRow.setHidden() doesn't exists. – Yugal Jindle Aug 03 '11 at 08:11
  • Please look at my answer: it's `row.**getRowStyle()**.setHidden()`. POI uses the Cell styling class on the rows as well. – OverZealous Aug 03 '11 at 08:13
  • See [the documentation](http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Row.html#getRowStyle%28%29) which shows the return type is CellStyle. – OverZealous Aug 03 '11 at 08:14
  • I got your point... but its strange.. that `currentRow.getRowStyle().setHidden(false);` is giving error : `Can-not find symbol getRowStyle()` According to the API it should be there.. or am I doing some mistake ? – Yugal Jindle Aug 03 '11 at 08:16
  • Check your version? Maybe you need to upgrade the POI library? – OverZealous Aug 03 '11 at 08:17
  • My POI version is 3.7 !! So does it supports.. this function call ? – Yugal Jindle Aug 03 '11 at 08:23
1

I had poi-3.7 and these methods didn't show up either.

Downloaded the latest one poi-3.8-beta4 and row.setRowStye() and row.getRowStye() are present

mahmudaq
  • 56
  • 2
0

Row.getRowStyle(): Returns the whole-row cell styles. Most rows won't have one of these, so will return null.

But you can check if this row is hidden by row.getZeroHeight() and show row using row.setZeroHeight(false);

msus
  • 1