Search in sources :

Example 1 with CTHpsMeasure

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

the class XWPFRun method setKerning.

public void setKerning(int kern) {
    CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
    CTHpsMeasure kernmes = pr.isSetKern() ? pr.getKern() : pr.addNewKern();
    kernmes.setVal(BigInteger.valueOf(kern));
}
Also used : CTRPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr) CTHpsMeasure(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHpsMeasure)

Example 2 with CTHpsMeasure

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

the class XWPFRun method setFontSize.

/**
     * Specifies the font size which shall be applied to all non complex script
     * characters in the contents of this run when displayed.
     * <p/>
     * If this element is not present, the default value is to leave the value
     * applied at previous level in the style hierarchy. If this element is
     * never applied in the style hierarchy, then any appropriate font size may
     * be used for non complex script characters.
     * </p>
     *
     * @param size
     */
public void setFontSize(int size) {
    BigInteger bint = new BigInteger("" + size);
    CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
    CTHpsMeasure ctSize = pr.isSetSz() ? pr.getSz() : pr.addNewSz();
    ctSize.setVal(bint.multiply(new BigInteger("2")));
}
Also used : CTRPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr) BigInteger(java.math.BigInteger) CTHpsMeasure(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHpsMeasure)

Aggregations

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