Search in sources :

Example 1 with CTSignedHpsMeasure

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

the class XWPFRun method setTextPosition.

/**
     * This element specifies the amount by which text shall be raised or
     * lowered for this run in relation to the default baseline of the
     * surrounding non-positioned text. This allows the text to be repositioned
     * without altering the font size of the contents.
     * <p/>
     * If the val attribute is positive, then the parent run shall be raised
     * above the baseline of the surrounding text by the specified number of
     * half-points. If the val attribute is negative, then the parent run shall
     * be lowered below the baseline of the surrounding text by the specified
     * number of half-points.
     * </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 the text shall not
     * be raised or lowered relative to the default baseline location for the
     * contents of this run.
     * </p>
     *
     * @param val
     */
public void setTextPosition(int val) {
    BigInteger bint = new BigInteger("" + val);
    CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
    CTSignedHpsMeasure position = pr.isSetPosition() ? pr.getPosition() : pr.addNewPosition();
    position.setVal(bint);
}
Also used : CTRPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr) BigInteger(java.math.BigInteger) CTSignedHpsMeasure(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSignedHpsMeasure)

Aggregations

BigInteger (java.math.BigInteger)1 CTRPr (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr)1 CTSignedHpsMeasure (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSignedHpsMeasure)1