Java Code Examples for org.docx4j.wml.RPr#getRFonts()

The following examples show how to use org.docx4j.wml.RPr#getRFonts() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WmlElementUtils.java    From docx4j-template with Apache License 2.0 6 votes vote down vote up
/**
 * @Description: 设置字体
 */
public static void setFontFamily(RPr runProperties, String cnFontFamily, String enFontFamily) {
    if (StringUtils.isNotBlank(cnFontFamily) || StringUtils.isNotBlank(enFontFamily)) {
        RFonts rf = runProperties.getRFonts();
        if (rf == null) {
            rf = new RFonts();
            runProperties.setRFonts(rf);
        }
        if (cnFontFamily != null) {
            rf.setEastAsia(cnFontFamily);
        }
        if (enFontFamily != null) {
            rf.setAscii(enFontFamily);
        }
    }
}
 
Example 2
Source File: Docx4j_工具类_S3_Test.java    From docx4j-template with Apache License 2.0 6 votes vote down vote up
/**
 * @Description: 设置字体
 */
public void setFontFamily(RPr runProperties, String cnFontFamily,
        String enFontFamily) {
    if (StringUtils.isNotBlank(cnFontFamily)
            || StringUtils.isNotBlank(enFontFamily)) {
        RFonts rf = runProperties.getRFonts();
        if (rf == null) {
            rf = new RFonts();
            runProperties.setRFonts(rf);
        }
        if (cnFontFamily != null) {
            rf.setEastAsia(cnFontFamily);
        }
        if (enFontFamily != null) {
            rf.setAscii(enFontFamily);
        }
    }
}
 
Example 3
Source File: Docx4j_创建表格_S5_Test.java    From docx4j-template with Apache License 2.0 5 votes vote down vote up
public void setFontFamily(RPr runProperties, String cnFontFamily,String enFontFamily) {  
    if (cnFontFamily != null||enFontFamily!=null) {  
        RFonts rf = runProperties.getRFonts();  
        if (rf == null) {  
            rf = new RFonts();  
            runProperties.setRFonts(rf);  
        }  
        if(cnFontFamily!=null){  
            rf.setEastAsia(cnFontFamily);  
        }  
        if(enFontFamily!=null){  
            rf.setAscii(enFontFamily);  
        }  
    }  
}