use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet in project poi by apache.
the class SXSSFSheet method setTabColor.
/**
* Set background color of the sheet tab
*
* @param colorIndex the indexed color to set, must be a constant from {@link IndexedColors}
*/
public void setTabColor(int colorIndex) {
CTWorksheet ct = _sh.getCTWorksheet();
CTSheetPr pr = ct.getSheetPr();
if (pr == null)
pr = ct.addNewSheetPr();
CTColor color = CTColor.Factory.newInstance();
color.setIndexed(colorIndex);
pr.setTabColor(color);
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet in project poi by apache.
the class TestXSSFPrintSetup method testSetGetValidSettings.
public void testSetGetValidSettings() {
CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
CTPageSetup pSetup = worksheet.addNewPageSetup();
pSetup.setUsePrinterDefaults(false);
XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
assertEquals(false, printSetup.getValidSettings());
printSetup.setValidSettings(true);
assertEquals(true, pSetup.getUsePrinterDefaults());
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet in project poi by apache.
the class TestXSSFPrintSetup method testSetGetHeaderFooterMargin.
public void testSetGetHeaderFooterMargin() {
CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
CTPageMargins pMargins = worksheet.addNewPageMargins();
pMargins.setHeader(1.5);
pMargins.setFooter(2);
XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
assertEquals(1.5, printSetup.getHeaderMargin(), 0.0);
assertEquals(2.0, printSetup.getFooterMargin(), 0.0);
printSetup.setHeaderMargin(5);
printSetup.setFooterMargin(3.5);
assertEquals(5.0, pMargins.getHeader(), 0.0);
assertEquals(3.5, pMargins.getFooter(), 0.0);
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet in project poi by apache.
the class TestXSSFPrintSetup method testSetGetUsePage.
public void testSetGetUsePage() {
CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
CTPageSetup pSetup = worksheet.addNewPageSetup();
pSetup.setUseFirstPageNumber(false);
XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
assertEquals(false, printSetup.getUsePage());
printSetup.setUsePage(true);
assertEquals(true, pSetup.getUseFirstPageNumber());
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet in project poi by apache.
the class TestXSSFPrintSetup method testSetGetOrientation.
public void testSetGetOrientation() {
CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
CTPageSetup pSetup = worksheet.addNewPageSetup();
pSetup.setOrientation(STOrientation.PORTRAIT);
XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
assertEquals(PrintOrientation.PORTRAIT, printSetup.getOrientation());
assertEquals(false, printSetup.getLandscape());
assertEquals(false, printSetup.getNoOrientation());
printSetup.setOrientation(PrintOrientation.LANDSCAPE);
assertEquals(pSetup.getOrientation().intValue(), printSetup.getOrientation().getValue());
assertEquals(true, printSetup.getLandscape());
assertEquals(false, printSetup.getNoOrientation());
}
Aggregations