use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet in project poi by apache.
the class TestXSSFPrintSetup method testSetGetDraft.
public void testSetGetDraft() {
CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
CTPageSetup pSetup = worksheet.addNewPageSetup();
pSetup.setDraft(false);
XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
assertEquals(false, printSetup.getDraft());
printSetup.setDraft(true);
assertEquals(true, pSetup.getDraft());
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet in project poi by apache.
the class TestXSSFPrintSetup method testSetGetNoColor.
public void testSetGetNoColor() {
CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
CTPageSetup pSetup = worksheet.addNewPageSetup();
pSetup.setBlackAndWhite(false);
XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
assertEquals(false, printSetup.getNoColor());
printSetup.setNoColor(true);
assertEquals(true, pSetup.getBlackAndWhite());
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet in project poi by apache.
the class TestXSSFPrintSetup method testSetGetHVResolution.
public void testSetGetHVResolution() {
CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
CTPageSetup pSetup = worksheet.addNewPageSetup();
pSetup.setHorizontalDpi(120);
pSetup.setVerticalDpi(100);
XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
assertEquals(120, printSetup.getHResolution());
assertEquals(100, printSetup.getVResolution());
printSetup.setHResolution((short) 150);
printSetup.setVResolution((short) 130);
assertEquals(150, pSetup.getHorizontalDpi());
assertEquals(130, pSetup.getVerticalDpi());
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet in project poi by apache.
the class TestXSSFPrintSetup method testSetGetFitWidthHeight.
public void testSetGetFitWidthHeight() {
CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
CTPageSetup pSetup = worksheet.addNewPageSetup();
pSetup.setFitToWidth(50);
pSetup.setFitToHeight(99);
XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
assertEquals(50, printSetup.getFitWidth());
assertEquals(99, printSetup.getFitHeight());
printSetup.setFitWidth((short) 66);
printSetup.setFitHeight((short) 80);
assertEquals(66, pSetup.getFitToWidth());
assertEquals(80, pSetup.getFitToHeight());
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet in project poi by apache.
the class TestColumnHelper method testGetSetColDefaultStyle.
@Test
public void testGetSetColDefaultStyle() throws IOException {
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet();
CTWorksheet ctWorksheet = sheet.getCTWorksheet();
ColumnHelper columnHelper = sheet.getColumnHelper();
// POI column 3, OOXML column 4
CTCol col = columnHelper.getOrCreateColumn1Based(4, false);
assertNotNull(col);
assertNotNull(columnHelper.getColumn(3, false));
columnHelper.setColDefaultStyle(3, 2);
assertEquals(2, columnHelper.getColDefaultStyle(3));
assertEquals(-1, columnHelper.getColDefaultStyle(4));
StylesTable stylesTable = workbook.getStylesSource();
CTXf cellXf = CTXf.Factory.newInstance();
cellXf.setFontId(0);
cellXf.setFillId(0);
cellXf.setBorderId(0);
cellXf.setNumFmtId(0);
cellXf.setXfId(0);
stylesTable.putCellXf(cellXf);
CTCol col_2 = ctWorksheet.getColsArray(0).addNewCol();
col_2.setMin(10);
col_2.setMax(12);
col_2.setStyle(1);
assertEquals(1, columnHelper.getColDefaultStyle(11));
XSSFCellStyle cellStyle = new XSSFCellStyle(0, 0, stylesTable, null);
columnHelper.setColDefaultStyle(11, cellStyle);
assertEquals(0, col_2.getStyle());
assertEquals(1, columnHelper.getColDefaultStyle(10));
workbook.close();
}
Aggregations