use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff in project poi by apache.
the class XWPFTableRow method setRepeatHeader.
/**
* This attribute controls whether to repeat a table's header row at the top
* of a table split across pages. NOTE - for a row to be repeated, all preceding
* rows in the table must also be repeated.
*
* @param repeat - if TRUE, repeat header row at the top of each page of table;
* if FALSE, don't repeat header row.
*/
public void setRepeatHeader(boolean repeat) {
CTTrPr trpr = getTrPr();
CTOnOff onoff = (trpr.sizeOfTblHeaderArray() > 0 ? trpr.getTblHeaderArray(0) : trpr.addNewTblHeader());
onoff.setVal(WMLHelper.convertBooleanToSTOnOff(repeat));
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff in project poi by apache.
the class XWPFTableRow method isCantSplitRow.
/**
* Return true if the "can't split row" value is true. The logic for this
* attribute is a little unusual: a TRUE value means DON'T allow rows to
* split, FALSE means allow rows to split.
*
* @return true if rows can't be split, false otherwise.
*/
public boolean isCantSplitRow() {
boolean isCant = false;
if (ctRow.isSetTrPr()) {
CTTrPr trpr = getTrPr();
if (trpr.sizeOfCantSplitArray() > 0) {
CTOnOff onoff = trpr.getCantSplitArray(0);
isCant = (onoff.isSetVal() ? WMLHelper.convertSTOnOffToBoolean(onoff.getVal()) : true);
}
}
return isCant;
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff in project poi by apache.
the class XWPFRun method setEmbossed.
public void setEmbossed(boolean value) {
CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
CTOnOff emboss = pr.isSetEmboss() ? pr.getEmboss() : pr.addNewEmboss();
emboss.setVal(value ? STOnOff.TRUE : STOnOff.FALSE);
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff in project poi by apache.
the class TestXWPFParagraph method testSetGetPageBreak.
@Test
public void testSetGetPageBreak() throws IOException {
XWPFDocument doc = new XWPFDocument();
XWPFParagraph p = doc.createParagraph();
CTP ctp = p.getCTP();
CTPPr ppr = ctp.getPPr() == null ? ctp.addNewPPr() : ctp.getPPr();
CTOnOff pageBreak = ppr.addNewPageBreakBefore();
pageBreak.setVal(STOnOff.FALSE);
assertEquals(false, p.isPageBreak());
p.setPageBreak(true);
assertEquals(STOnOff.TRUE, ppr.getPageBreakBefore().getVal());
doc.close();
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff in project poi by apache.
the class TestXWPFRun method testCTOnOff.
/*
* bug 59208
* Purpose: test all valid boolean-like values
* exercise isCTOnOff(CTOnOff) through all valid permutations
*/
@Test
public void testCTOnOff() {
CTRPr rpr = ctRun.addNewRPr();
CTOnOff bold = rpr.addNewB();
XWPFRun run = new XWPFRun(ctRun, irb);
// True values: "true", "1", "on"
bold.setVal(STOnOff.TRUE);
assertEquals(true, run.isBold());
bold.setVal(STOnOff.X_1);
assertEquals(true, run.isBold());
bold.setVal(STOnOff.ON);
assertEquals(true, run.isBold());
// False values: "false", "0", "off"
bold.setVal(STOnOff.FALSE);
assertEquals(false, run.isBold());
bold.setVal(STOnOff.X_0);
assertEquals(false, run.isBold());
bold.setVal(STOnOff.OFF);
assertEquals(false, run.isBold());
}
Aggregations