Search in sources :

Example 11 with CTOnOff

use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff in project poi by apache.

the class XWPFRun method setDoubleStrikethrough.

/**
     * Specifies that the contents of this run shall be displayed with a
     * double horizontal line through the center of the line.
     *
     * @see #setStrikeThrough(boolean) for the rules about this
     */
public void setDoubleStrikethrough(boolean value) {
    CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
    CTOnOff dstrike = pr.isSetDstrike() ? pr.getDstrike() : pr.addNewDstrike();
    dstrike.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 12 with CTOnOff

use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff in project poi by apache.

the class XWPFRun method setStrikeThrough.

/**
     * Specifies that the contents of this run shall be displayed with a single
     * horizontal line through the center of the line.
     * <p/>
     * This formatting property is a toggle property, which specifies that its
     * behaviour differs between its use within a style definition and its use as
     * direct formatting. When used as part of a style definition, setting this
     * property shall toggle the current state of that property as specified up
     * to this point in the hierarchy (i.e. applied to not applied, and vice
     * versa). Setting it to false (or an equivalent) shall result in the
     * current setting remaining unchanged. However, when used as direct
     * formatting, setting this property to true or false shall set the absolute
     * state of the resulting property.
     * </p>
     * <p/>
     * If this element is not present, the default value is to leave the
     * formatting applied at previous level in the style hierarchy. If this
     * element is never applied in the style hierarchy, then strikethrough shall
     * not be applied to the contents of this run.
     * </p>
     *
     * @param value <code>true</code> if the strike property is applied to
     *              this run
     */
public void setStrikeThrough(boolean value) {
    CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
    CTOnOff strike = pr.isSetStrike() ? pr.getStrike() : pr.addNewStrike();
    strike.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 13 with CTOnOff

use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff in project poi by apache.

the class XWPFRun method setCapitalized.

public void setCapitalized(boolean value) {
    CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
    CTOnOff caps = pr.isSetCaps() ? pr.getCaps() : pr.addNewCaps();
    caps.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 14 with CTOnOff

use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff in project poi by apache.

the class XWPFRun method setShadow.

public void setShadow(boolean value) {
    CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
    CTOnOff shadow = pr.isSetShadow() ? pr.getShadow() : pr.addNewShadow();
    shadow.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 15 with CTOnOff

use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff in project poi by apache.

the class TestXWPFParagraph method testSetGetWordWrap.

@Test
public void testSetGetWordWrap() throws IOException {
    XWPFDocument doc = new XWPFDocument();
    XWPFParagraph p = doc.createParagraph();
    CTP ctp = p.getCTP();
    CTPPr ppr = ctp.getPPr() == null ? ctp.addNewPPr() : ctp.getPPr();
    CTOnOff wordWrap = ppr.addNewWordWrap();
    wordWrap.setVal(STOnOff.FALSE);
    assertEquals(false, p.isWordWrap());
    p.setWordWrapped(true);
    assertEquals(STOnOff.TRUE, ppr.getWordWrap().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)

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