As i went through apache poi documentation, they say you can get information of freeze or split pane using PanelInformation object in util package. And for that i need object of HSSFSheet class. I am able to get HSSFSHeet object but when I am trying to get PanelInformation from it using getPanelInformation method. It returns me null.
HSSFWorkbook workbook = new HSSFWorkbook(file);
HSSFSheet sheet = workbook.getSheetAt(sheetNumber);
workbook.setActiveSheet(sheetNumber);
System.out.println(sheet.getPaneInformation());
See the documentation here:
https://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Sheet.html
The method you are looking for I believe is the method getPaneInformation() which will tell you if the pane you are currently looking at is a freeze or split pane.
Answer:
Returning null
is normal behavior for the getPaneInformation
method.
Returns:
null if no pane configured, or the pane information.
This indicates that neither a split pane nor a freeze pane has been set up for your Sheet
. If you did create a split pane or a freeze pane, either in the workbook you’re reading, or programmatically with createSplitPane
or createFreezePane
, then getPaneInformation
would return a non-null
PaneInformation
object.
Answer:
This question is quite old, so I put this information for the sake of sharing Knowledge.
As written previously, you can find out if some rows are frozen with:
row.getSheet().getPaneInformation().isFreezePane();
Then, you can get the first index of the non-frozen row with:
row.getSheet().getPaneInformation().getHorizontalSplitTopRow();
According to the Javadoc:
For a horizontal split returns the top row in the BOTTOM pane.
In case of vertical split, one has to use:
row.getSheet().getVerticalSplitLeftColumn();