How to Un-Hide a hidden row in Excel using Apache

2019-05-26 07:16发布

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.. !!

3条回答
小情绪 Triste *
2楼-- · 2019-05-26 07:40

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);

查看更多
爷、活的狠高调
3楼-- · 2019-05-26 07:51

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

查看更多
孤傲高冷的网名
4楼-- · 2019-05-26 07:52

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

currentRow.getRowStyle().setHidden(false);

More info on getRowStyle.

查看更多
登录 后发表回答