Search in sources :

Example 11 with U

use of org.docx4j.wml.U in project docx4j-template by vindell.

the class Docx4J_简单例子2 method getRPr.

/**
 * 创建字体
 *
 * @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;
}
Also used : RPr(org.docx4j.wml.RPr) U(org.docx4j.wml.U) HpsMeasure(org.docx4j.wml.HpsMeasure) Color(org.docx4j.wml.Color) RFonts(org.docx4j.wml.RFonts) BigInteger(java.math.BigInteger) BooleanDefaultTrue(org.docx4j.wml.BooleanDefaultTrue)

Aggregations

U (org.docx4j.wml.U)11 RPr (org.docx4j.wml.RPr)7 BigInteger (java.math.BigInteger)4 BooleanDefaultTrue (org.docx4j.wml.BooleanDefaultTrue)4 Color (org.docx4j.wml.Color)4 HpsMeasure (org.docx4j.wml.HpsMeasure)4 RFonts (org.docx4j.wml.RFonts)4 R (org.docx4j.wml.R)3 Text (org.docx4j.wml.Text)3 CustomTag (eu.transkribus.core.model.beans.customtags.CustomTag)2 Jc (org.docx4j.wml.Jc)2 P (org.docx4j.wml.P)2 PPr (org.docx4j.wml.PPr)2 ParaRPr (org.docx4j.wml.ParaRPr)2 JAXBPageTranscript (eu.transkribus.core.model.beans.JAXBPageTranscript)1 TrpPage (eu.transkribus.core.model.beans.TrpPage)1 TrpTranscriptMetadata (eu.transkribus.core.model.beans.TrpTranscriptMetadata)1 AbbrevTag (eu.transkribus.core.model.beans.customtags.AbbrevTag)1 CommentTag (eu.transkribus.core.model.beans.customtags.CommentTag)1 CustomTagList (eu.transkribus.core.model.beans.customtags.CustomTagList)1