use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr 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);
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr 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);
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr in project poi by apache.
the class XWPFRun method setSubscript.
/**
* Specifies the alignment which shall be applied to the contents of this
* run in relation to the default appearance of the run's text. This allows
* the text to be repositioned as subscript or superscript without altering
* the font size of the run properties.
* <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 subscript or superscript relative to the default baseline location for
* the contents of this run.
* </p>
*
* @param valign
* @see VerticalAlign
*/
public void setSubscript(VerticalAlign valign) {
CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
CTVerticalAlignRun ctValign = pr.isSetVertAlign() ? pr.getVertAlign() : pr.addNewVertAlign();
ctValign.setVal(STVerticalAlignRun.Enum.forInt(valign.getValue()));
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr in project poi by apache.
the class XWPFRun method getFontFamily.
/**
* Gets the font family for the specified font char range.
* If fcr is null, the font char range "ascii" is used
*
* @param fcr the font char range, defaults to "ansi"
* @return a string representing the font famil
*/
public String getFontFamily(FontCharRange fcr) {
CTRPr pr = run.getRPr();
if (pr == null || !pr.isSetRFonts())
return null;
CTFonts fonts = pr.getRFonts();
switch(fcr == null ? FontCharRange.ascii : fcr) {
default:
case ascii:
return fonts.getAscii();
case cs:
return fonts.getCs();
case eastAsia:
return fonts.getEastAsia();
case hAnsi:
return fonts.getHAnsi();
}
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr 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")));
}
Aggregations