use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet in project poi by apache.
the class TestXSSFPrintSetup method testSetGetScale.
public void testSetGetScale() {
CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
CTPageSetup pSetup = worksheet.addNewPageSetup();
pSetup.setScale(9);
XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
assertEquals(9, printSetup.getScale());
printSetup.setScale((short) 100);
assertEquals(100, pSetup.getScale());
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet in project poi by apache.
the class TestXSSFBugs method bug49325.
/**
* ensure that CTPhoneticPr is loaded by the ooxml test suite so that it is included in poi-ooxml-schemas
*/
@Test
public void bug49325() throws IOException {
XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("49325.xlsx");
CTWorksheet sh = wb.getSheetAt(0).getCTWorksheet();
assertNotNull(sh.getPhoneticPr());
wb.close();
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet in project poi by apache.
the class SXSSFSheet method setWorksheetOutlineLevelRow.
private void setWorksheetOutlineLevelRow() {
CTWorksheet ct = _sh.getCTWorksheet();
CTSheetFormatPr pr = ct.isSetSheetFormatPr() ? ct.getSheetFormatPr() : ct.addNewSheetFormatPr();
if (outlineLevelRow > 0) {
pr.setOutlineLevelRow((short) outlineLevelRow);
}
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet in project poi by apache.
the class TestColumnHelper method createHiddenAndBestFitColsWithHelper.
/**
* Creates and adds a hidden column and then a best fit column with the given min/max pairs.
* Suitable for testing handling of overlap.
*/
private static CTCols createHiddenAndBestFitColsWithHelper(int hiddenMin, int hiddenMax, int bestFitMin, int bestFitMax) {
CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
ColumnHelper helper = new ColumnHelper(worksheet);
CTCols cols = worksheet.getColsArray(0);
CTCol hidden = createCol(hiddenMin, hiddenMax);
hidden.setHidden(true);
helper.addCleanColIntoCols(cols, hidden);
CTCol bestFit = createCol(bestFitMin, bestFitMax);
bestFit.setBestFit(true);
helper.addCleanColIntoCols(cols, bestFit);
return cols;
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet in project poi by apache.
the class TestColumnHelper method testGetColumn.
@Test
public void testGetColumn() {
CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
CTCols cols1 = worksheet.addNewCols();
CTCol col1 = cols1.addNewCol();
col1.setMin(1);
col1.setMax(1);
col1.setWidth(88);
col1.setHidden(true);
CTCol col2 = cols1.addNewCol();
col2.setMin(2);
col2.setMax(3);
CTCols cols2 = worksheet.addNewCols();
CTCol col4 = cols2.addNewCol();
col4.setMin(3);
col4.setMax(6);
// Remember - POI column 0 == OOXML column 1
ColumnHelper helper = new ColumnHelper(worksheet);
assertNotNull(helper.getColumn(0, false));
assertNotNull(helper.getColumn(1, false));
assertEquals(88.0, helper.getColumn(0, false).getWidth(), 0.0);
assertEquals(0.0, helper.getColumn(1, false).getWidth(), 0.0);
assertTrue(helper.getColumn(0, false).getHidden());
assertFalse(helper.getColumn(1, false).getHidden());
assertNull(helper.getColumn(99, false));
assertNotNull(helper.getColumn(5, false));
}
Aggregations