本文整理汇总了Java中org.docx4j.wml.RPr.setSz方法的典型用法代码示例。如果您正苦于以下问题:Java RPr.setSz方法的具体用法?Java RPr.setSz怎么用?Java RPr.setSz使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.docx4j.wml.RPr
的用法示例。
在下文中一共展示了RPr.setSz方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runProperties
import org.docx4j.wml.RPr; //导入方法依赖的package包/类
private RPr runProperties(final String fontName, final int fontSize, final boolean bold) {
final RPr rpr = this.wmlObjectFactory.createRPr();
final RFonts font = this.wmlObjectFactory.createRFonts();
font.setAscii(fontName);
font.setHAnsi(fontName);
rpr.setRFonts(font);
final HpsMeasure size = this.wmlObjectFactory.createHpsMeasure();
size.setVal(BigInteger.valueOf(fontSize * 2));
rpr.setSz(size);
final BooleanDefaultTrue isBold = this.wmlObjectFactory.createBooleanDefaultTrue();
isBold.setVal(bold);
rpr.setB(isBold);
return rpr;
}
示例2: setFontSize
import org.docx4j.wml.RPr; //导入方法依赖的package包/类
/**
* 本方法为可运行块添加字体大小信息. 首先创建一个"半点"尺码对象, 然后设置fontSize
* 参数作为该对象的值, 最后我们分别设置sz和szCs的字体大小.
* Finally we'll set the non-complex and complex script font sizes, sz and szCs respectively.
*/
public void setFontSize(RPr runProperties, String fontSize) {
HpsMeasure size = new HpsMeasure();
size.setVal(new BigInteger(fontSize));
runProperties.setSz(size);
runProperties.setSzCs(size);
}
示例3: setFontSize
import org.docx4j.wml.RPr; //导入方法依赖的package包/类
/**
* @Description: 设置字体大小
*/
public void setFontSize(RPr runProperties, String fontSize) {
if (StringUtils.isNotBlank(fontSize)) {
HpsMeasure size = new HpsMeasure();
size.setVal(new BigInteger(fontSize));
runProperties.setSz(size);
runProperties.setSzCs(size);
}
}
示例4: getRPr
import org.docx4j.wml.RPr; //导入方法依赖的package包/类
/**
* 创建字体
*
* @param isBlod
* 粗体
* @param isUnderLine
* 下划线
* @param isItalic
* 斜体
* @param isStrike
* 删除线
*/
public RPr getRPr(ObjectFactory factory, String fontFamily,
String colorVal, String fontSize, STHint sTHint, boolean isBlod,
boolean isUnderLine, boolean isItalic, boolean isStrike) {
RPr rPr = factory.createRPr();
RFonts rf = new RFonts();
rf.setHint(sTHint);
rf.setAscii(fontFamily);
rf.setHAnsi(fontFamily);
rPr.setRFonts(rf);
BooleanDefaultTrue bdt = factory.createBooleanDefaultTrue();
rPr.setBCs(bdt);
if (isBlod) {
rPr.setB(bdt);
}
if (isItalic) {
rPr.setI(bdt);
}
if (isStrike) {
rPr.setStrike(bdt);
}
if (isUnderLine) {
U underline = new U();
underline.setVal(UnderlineEnumeration.SINGLE);
rPr.setU(underline);
}
Color color = new Color();
color.setVal(colorVal);
rPr.setColor(color);
HpsMeasure sz = new HpsMeasure();
sz.setVal(new BigInteger(fontSize));
rPr.setSz(sz);
rPr.setSzCs(sz);
return rPr;
}
示例5: getRPr
import org.docx4j.wml.RPr; //导入方法依赖的package包/类
/**
* 创建字体
*
* @param isBlod
* 粗体
* @param isUnderLine
* 下划线
* @param isItalic
* 斜体
* @param isStrike
* 删除线
*/
public RPr getRPr(ObjectFactory factory, String fontFamily,
String colorVal, String fontSize, STHint sTHint, boolean isBlod,
boolean isUnderLine, boolean isItalic, boolean isStrike) {
RPr rPr = factory.createRPr();
RFonts rf = new RFonts();
rf.setHint(sTHint);
rf.setAscii(fontFamily);
rf.setHAnsi(fontFamily);
rPr.setRFonts(rf);
BooleanDefaultTrue bdt = factory.createBooleanDefaultTrue();
rPr.setBCs(bdt);
if (isBlod) {
rPr.setB(bdt);
}
if (isItalic) {
rPr.setI(bdt);
}
if (isStrike) {
rPr.setStrike(bdt);
}
if (isUnderLine) {
U underline = new U();
underline.setVal(UnderlineEnumeration.SINGLE);
rPr.setU(underline);
}
Color color = new Color();
color.setVal(colorVal);
rPr.setColor(color);
HpsMeasure sz = new HpsMeasure();
sz.setVal(new BigInteger(fontSize));
rPr.setSz(sz);
rPr.setSzCs(sz);
return rPr;
}
示例6: setFontSize
import org.docx4j.wml.RPr; //导入方法依赖的package包/类
/**
* 本方法为可运行块添加字体大小信息. 首先创建一个"半点"尺码对象, 然后设置fontSize
* 参数作为该对象的值, 最后我们分别设置sz和szCs的字体大小.
* Finally we'll set the non-complex and complex script font sizes, sz and szCs respectively.
*/
private static void setFontSize(RPr runProperties, String fontSize) {
HpsMeasure size = new HpsMeasure();
size.setVal(new BigInteger(fontSize));
runProperties.setSz(size);
runProperties.setSzCs(size);
}
示例7: setFontSize
import org.docx4j.wml.RPr; //导入方法依赖的package包/类
public void setFontSize(RPr runProperties, String fontSize) {
if (fontSize != null && !fontSize.isEmpty()) {
HpsMeasure size = new HpsMeasure();
size.setVal(new BigInteger(fontSize));
runProperties.setSz(size);
runProperties.setSzCs(size);
}
}
示例8: createFillerP
import org.docx4j.wml.RPr; //导入方法依赖的package包/类
private static P createFillerP() {
org.docx4j.wml.ObjectFactory wmlObjectFactory = Context.getWmlObjectFactory();
P p = wmlObjectFactory.createP();
// Create object for pPr
PPr ppr = wmlObjectFactory.createPPr();
p.setPPr(ppr);
// Create object for rPr
ParaRPr pararpr = wmlObjectFactory.createParaRPr();
// Create object for spacing
PPrBase.Spacing pprbasespacing = wmlObjectFactory.createPPrBaseSpacing();
ppr.setSpacing(pprbasespacing);
pprbasespacing.setBefore( BigInteger.valueOf( 800) );
pprbasespacing.setAfter( BigInteger.valueOf( 800) );
// Create object for r
R r = wmlObjectFactory.createR();
p.getContent().add( r);
// Create object for rPr
RPr rpr = wmlObjectFactory.createRPr();
r.setRPr(rpr);
// Create object for sz
HpsMeasure hpsmeasure3 = wmlObjectFactory.createHpsMeasure();
rpr.setSz(hpsmeasure3);
hpsmeasure3.setVal( BigInteger.valueOf( 96) );
// Create object for t (wrapped in JAXBElement)
Text text = wmlObjectFactory.createText();
JAXBElement<org.docx4j.wml.Text> textWrapped = wmlObjectFactory.createRT(text);
r.getContent().add( textWrapped);
text.setValue( "BODY CONTENT");
return p;
}
示例9: setFontSize
import org.docx4j.wml.RPr; //导入方法依赖的package包/类
private void setFontSize(RPr runProperties, String fontSize) {
if (fontSize != null && !fontSize.isEmpty()) {
HpsMeasure size = new HpsMeasure();
size.setVal(new BigInteger(fontSize));
runProperties.setSz(size);
runProperties.setSzCs(size);
}
}
示例10: getRPrStyle
import org.docx4j.wml.RPr; //导入方法依赖的package包/类
public RPr getRPrStyle(ObjectFactory factory, String fontFamily,
String colorVal, String fontSize, STHint sTHint, boolean isBlod,
boolean isItalic, boolean isStrike, boolean isUnderLine,
UnderlineEnumeration underLineStyle, String underLineColor,
boolean isHightLight, String hightLightValue, boolean isShd,
STShd shdValue, String shdColor, CTVerticalAlignRun stRunEnum) {
RPr rPr = factory.createRPr();
RFonts rf = new RFonts();
if (sTHint != null) {
rf.setHint(sTHint);
}
if (fontFamily != null) {
rf.setAscii(fontFamily);
rf.setEastAsia(fontFamily);
rf.setHAnsi(fontFamily);
}
rPr.setRFonts(rf);
if (colorVal != null) {
Color color = new Color();
color.setVal(colorVal);
rPr.setColor(color);
}
if (fontSize != null) {
HpsMeasure sz = new HpsMeasure();
sz.setVal(new BigInteger(fontSize));
rPr.setSz(sz);
rPr.setSzCs(sz);
}
BooleanDefaultTrue bdt = factory.createBooleanDefaultTrue();
if (isBlod) {
rPr.setB(bdt);
}
if (isItalic) {
rPr.setI(bdt);
}
if (isStrike) {
rPr.setStrike(bdt);
}
if (isUnderLine) {
U underline = new U();
if (underLineStyle != null) {
underline.setVal(underLineStyle);
}
if (underLineColor != null) {
underline.setColor(underLineColor);
}
rPr.setU(underline);
}
if (isHightLight) {
Highlight hight = new Highlight();
hight.setVal(hightLightValue);
rPr.setHighlight(hight);
}
if (isShd) {
CTShd shd = new CTShd();
if (shdColor != null) {
shd.setColor(shdColor);
}
if (shdValue != null) {
shd.setVal(shdValue);
}
rPr.setShd(shd);
}
if (stRunEnum != null) {
rPr.setVertAlign(stRunEnum);
}
return rPr;
}
示例11: changeFontSize
import org.docx4j.wml.RPr; //导入方法依赖的package包/类
void changeFontSize(RPr rp, int fSize) {
HpsMeasure size = new HpsMeasure();
size.setVal(BigInteger.valueOf(fSize));
rp.setSz(size);
}
示例12: changeFontSize
import org.docx4j.wml.RPr; //导入方法依赖的package包/类
/**
* Change the font size of the given run properties to the given value.
*
* @param runProperties
* @param fontSize Twice the size needed, as it is specified as half-point value
*/
private static void changeFontSize(RPr runProperties, int fontSize) {
HpsMeasure size = new HpsMeasure();
size.setVal(BigInteger.valueOf(fontSize));
runProperties.setSz(size);
}