import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPageBreak;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPageMargins;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPageSetUpPr;
+import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPane;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPrintOptions;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRow;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSelection;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetView;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetViews;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
+import org.openxmlformats.schemas.spreadsheetml.x2006.main.STPane;
+import org.openxmlformats.schemas.spreadsheetml.x2006.main.STPaneState;
public class XSSFSheet implements Sheet {
}
public void createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow) {
- // TODO Auto-generated method stub
-
+ this.createFreezePane(colSplit, rowSplit);
+ this.showInPane((short)topRow, (short)leftmostColumn);
}
public void createFreezePane(int colSplit, int rowSplit) {
- // TODO Auto-generated method stub
-
+ getPane().setXSplit(colSplit);
+ getPane().setYSplit(rowSplit);
+ // make bottomRight default active pane
+ getPane().setActivePane(STPane.BOTTOM_RIGHT);
}
/**
return xrow;
}
- public void createSplitPane(int splitPos, int splitPos2, int leftmostColumn, int topRow, int activePane) {
- // TODO Auto-generated method stub
-
+ public void createSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane) {
+ createFreezePane(xSplitPos, ySplitPos, leftmostColumn, topRow);
+ getPane().setActivePane(STPane.Enum.forInt(activePane));
}
public void dumpDrawingRecords(boolean fat) {
}
return false;
}
+
+ private CTPane getPane() {
+ if (getDefaultSheetView().getPane() == null) {
+ getDefaultSheetView().addNewPane();
+ }
+ return getDefaultSheetView().getPane();
+ }
}
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
+import org.openxmlformats.schemas.spreadsheetml.x2006.main.STPane;
+import org.openxmlformats.schemas.spreadsheetml.x2006.main.STPaneState;
public class TestXSSFSheet extends TestCase {
}
+ public void testCreateFreezePane() {
+ Workbook workbook = new XSSFWorkbook();
+ CTSheet ctSheet = CTSheet.Factory.newInstance();
+ CTWorksheet ctWorksheet = CTWorksheet.Factory.newInstance();
+ XSSFSheet sheet = new XSSFSheet(ctSheet, ctWorksheet, (XSSFWorkbook) workbook);
+ sheet.createFreezePane(2, 4);
+ assertEquals((double)2, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getXSplit());
+ assertEquals(STPane.BOTTOM_RIGHT, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getActivePane());
+ sheet.createFreezePane(3, 6, 10, 10);
+ assertEquals((double)3, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getXSplit());
+ assertEquals(10, sheet.getTopRow());
+ assertEquals(10, sheet.getLeftCol());
+ sheet.createSplitPane(4, 8, 12, 12, 1);
+ assertEquals((double)8, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getYSplit());
+ assertEquals(STPane.BOTTOM_RIGHT, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getActivePane());
+ }
+
private XSSFSheet createSheet(XSSFWorkbook workbook, String name) {
XSSFSheet sheet = (XSSFSheet) workbook.createSheet(name);