Search in sources :

Example 6 with CTOnOff

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));
}
Also used : CTOnOff(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff) CTTrPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTrPr)

Example 7 with CTOnOff

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;
}
Also used : CTOnOff(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff) CTTrPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTrPr)

Example 8 with CTOnOff

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);
}
Also used : CTRPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr) CTOnOff(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff)

Example 9 with CTOnOff

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();
}
Also used : CTPPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr) CTOnOff(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff) CTP(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP) Test(org.junit.Test)

Example 10 with CTOnOff

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());
}
Also used : CTRPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr) CTOnOff(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff) Test(org.junit.Test)

Aggregations

CTOnOff (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff)17 CTRPr (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr)10 CTTrPr (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTrPr)4 Test (org.junit.Test)3 CTP (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP)2 CTPPr (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr)2