当前位置: 首页>>代码示例>>Java>>正文


Java RPr.setRFonts方法代码示例

本文整理汇总了Java中org.docx4j.wml.RPr.setRFonts方法的典型用法代码示例。如果您正苦于以下问题:Java RPr.setRFonts方法的具体用法?Java RPr.setRFonts怎么用?Java RPr.setRFonts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.docx4j.wml.RPr的用法示例。


在下文中一共展示了RPr.setRFonts方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:mizitch,项目名称:story-inspector,代码行数:19,代码来源:DocXReportSummaryWriter.java

示例2: setDefaultFont

import org.docx4j.wml.RPr; //导入方法依赖的package包/类
/**
 * 为 {@link org.docx4j.openpackaging.packages.WordprocessingMLPackage} 配置默认字体
 */
public static void setDefaultFont(WordprocessingMLPackage wmlPackage,String fontName) throws Docx4JException {
       //设置文件默认字体
       RFonts rfonts = Context.getWmlObjectFactory().createRFonts(); 
       rfonts.setAsciiTheme(null);
       rfonts.setAscii(fontName);
       rfonts.setHAnsi(fontName);
       rfonts.setEastAsia(fontName);
       RPr rpr = wmlPackage.getMainDocumentPart().getPropertyResolver().getDocumentDefaultRPr();
       rpr.setRFonts(rfonts);
   }
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:14,代码来源:PhysicalFontUtils.java

示例3: 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;
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:50,代码来源:Docx4J_例子2.java

示例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;  
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:50,代码来源:Docx4J_简单例子2.java

示例5: 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;  
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:70,代码来源:Docx4j_创建批注_S3_Test.java

示例6: changeFont

import org.docx4j.wml.RPr; //导入方法依赖的package包/类
void changeFont(RPr rp, String font) {
    RFonts rf = new RFonts();
    rf.setAscii(font);
    rf.setHAnsi(font);
    rp.setRFonts(rf);
}
 
开发者ID:anubiann00b,项目名称:TextToDocx,代码行数:7,代码来源:Generator.java

示例7: changeFontToArial

import org.docx4j.wml.RPr; //导入方法依赖的package包/类
/**
 *  Change the font of the given run properties to Arial.
 *
 *  A run font specifies the fonts which shall be used to display the contents
 *  of the run. Of the four possible types of content, we change the styling of
 *  two of them: ASCII and High ANSI.
 *  Finally we add the run font to the run properties.
 *
 *  @param runProperties
 */
private static void changeFontToArial(RPr runProperties) {
    RFonts runFont = new RFonts();
    runFont.setAscii("Arial");
    runFont.setHAnsi("Arial");
    runProperties.setRFonts(runFont);
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:17,代码来源:ChangingTheStyleSheet.java


注:本文中的org.docx4j.wml.RPr.setRFonts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。