Search in sources :

Example 1 with CTOnOff

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

the class XWPFRun method setItalic.

/**
     * Whether the bold property shall be applied to all non-complex script
     * characters in the contents of this run when displayed in a document
     * <p/>
     * <p/>
     * This formatting property is a toggle property, which specifies that its
     * behavior 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 <code>false</code> (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 bold shall not be
     * applied to non-complex script characters.
     * </p>
     *
     * @param value <code>true</code> if the italic property is applied to
     *              this run
     */
public void setItalic(boolean value) {
    CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
    CTOnOff italic = pr.isSetI() ? pr.getI() : pr.addNewI();
    italic.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 2 with CTOnOff

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

the class XWPFRun method setImprinted.

public void setImprinted(boolean value) {
    CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
    CTOnOff imprinted = pr.isSetImprint() ? pr.getImprint() : pr.addNewImprint();
    imprinted.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 3 with CTOnOff

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

the class XWPFRun method setSmallCaps.

public void setSmallCaps(boolean value) {
    CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
    CTOnOff caps = pr.isSetSmallCaps() ? pr.getSmallCaps() : pr.addNewSmallCaps();
    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 4 with CTOnOff

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

the class XWPFSettings method setUpdateFields.

/**
     * Enforces fields update on document open (in Word).
     * In the settings.xml file <br/>
     * sets the updateSettings value to true (w:updateSettings w:val="true")
     * <p/>
     * NOTICES:
     * <ul>
     * <li>Causing Word to ask on open: "This document contains fields that may refer to other files. Do you want to update the fields in this document?"
     * (if "Update automatic links at open" is enabled)</li>
     * <li>Flag is removed after saving with changes in Word </li>
     * </ul>
     */
public void setUpdateFields() {
    CTOnOff onOff = CTOnOff.Factory.newInstance();
    onOff.setVal(STOnOff.TRUE);
    ctSettings.setUpdateFields(onOff);
}
Also used : CTOnOff(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff)

Example 5 with CTOnOff

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

the class XWPFRun method setBold.

/**
     * Whether the bold property shall be applied to all non-complex script
     * characters in the contents of this run when displayed in a document.
     * <p>
     * This formatting property is a toggle property, which specifies that its
     * behavior 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 <code>false</code> (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 bold shall not be
     * applied to non-complex script characters.
     * </p>
     *
     * @param value <code>true</code> if the bold property is applied to
     *              this run
     */
public void setBold(boolean value) {
    CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
    CTOnOff bold = pr.isSetB() ? pr.getB() : pr.addNewB();
    bold.setVal(value ? STOnOff.TRUE : STOnOff.FALSE);
}
Also used : CTRPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr) CTOnOff(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff)

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