I am using Apache POI XSSF and HSSF API.
If I do this, it only freezes the pane (no split):
sheet1.createSplitPane(8000, 5000, 0, 0, Sheet.PANE_LOWER_RIGHT);
sheet1.createFreezePane(0, 1);
and if I do this, it only splits the pane (no freeze):
sheet1.createFreezePane(0, 1);
sheet1.createSplitPane(8000, 5000, 0, 0, Sheet.PANE_LOWER_RIGHT);
How should I make both work together in the same sheet?
As far as I can tell, Excel doesn't support having both a freeze pane and a split pane in the same sheet. This link appears to indicate that Excel doesn't allow it.
Regardless of whether Excel does/will allow it, POI doesn't support it either.
The Javadocs for createSplitPane explicitly state:
Creates a split pane. Any existing freezepane or split pane is overwritten.
and the Javadocs for createFreezePane say something similar.
Creates a split (freezepane). Any existing freezepane or split pane is overwritten.
Also, just opening up Excel (I have Excel 2010), if I create a split pane, then a freeze pane, the split pane disappears. If I then create a split pane, then the freeze pane disappears.
Excel (at least through 2010) doesn't appear to support both a freeze pane and a split pane simultaneously, and Apache POI respects that fact.