Search in sources :

Example 1 with BooleanDefaultTrue

use of org.docx4j.wml.BooleanDefaultTrue in project Java-Tutorial by gpcodervn.

the class NumberingTest method createNormal.

public Style createNormal() {
    org.docx4j.wml.ObjectFactory wmlObjectFactory = new org.docx4j.wml.ObjectFactory();
    Style style = wmlObjectFactory.createStyle();
    style.setStyleId("Normal");
    // Create object for qFormat
    BooleanDefaultTrue booleandefaulttrue = wmlObjectFactory.createBooleanDefaultTrue();
    style.setQFormat(booleandefaulttrue);
    // Create object for name
    Style.Name stylename = wmlObjectFactory.createStyleName();
    style.setName(stylename);
    stylename.setVal("Normal");
    style.setType("paragraph");
    style.setDefault(true);
    return style;
}
Also used : Style(org.docx4j.wml.Style) BooleanDefaultTrue(org.docx4j.wml.BooleanDefaultTrue)

Example 2 with BooleanDefaultTrue

use of org.docx4j.wml.BooleanDefaultTrue in project Java-Tutorial by gpcodervn.

the class Docx4jUtils method addItalicStyle.

private void addItalicStyle(RPr runProperties) {
    BooleanDefaultTrue b = new BooleanDefaultTrue();
    b.setVal(true);
    runProperties.setI(b);
}
Also used : BooleanDefaultTrue(org.docx4j.wml.BooleanDefaultTrue)

Example 3 with BooleanDefaultTrue

use of org.docx4j.wml.BooleanDefaultTrue in project Java-Tutorial by gpcodervn.

the class Docx4jUtils method addBoldStyle.

private void addBoldStyle(RPr runProperties) {
    BooleanDefaultTrue b = new BooleanDefaultTrue();
    b.setVal(true);
    runProperties.setB(b);
}
Also used : BooleanDefaultTrue(org.docx4j.wml.BooleanDefaultTrue)

Example 4 with BooleanDefaultTrue

use of org.docx4j.wml.BooleanDefaultTrue 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) ParaRPr(org.docx4j.wml.ParaRPr) 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)

Example 5 with BooleanDefaultTrue

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

the class Docx4j_创建批注_S3_Test method getRPrStyle.

// 字体样式
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;
}
Also used : Highlight(org.docx4j.wml.Highlight) 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) CTShd(org.docx4j.wml.CTShd) BooleanDefaultTrue(org.docx4j.wml.BooleanDefaultTrue)

Aggregations

BooleanDefaultTrue (org.docx4j.wml.BooleanDefaultTrue)28 RPr (org.docx4j.wml.RPr)9 Color (org.docx4j.wml.Color)6 HpsMeasure (org.docx4j.wml.HpsMeasure)5 ObjectFactory (org.docx4j.wml.ObjectFactory)5 P (org.docx4j.wml.P)5 R (org.docx4j.wml.R)5 BigInteger (java.math.BigInteger)4 RFonts (org.docx4j.wml.RFonts)4 U (org.docx4j.wml.U)4 File (java.io.File)2 WordprocessingMLPackage (org.docx4j.openpackaging.packages.WordprocessingMLPackage)2 MainDocumentPart (org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart)2 ParaRPr (org.docx4j.wml.ParaRPr)2 TcPr (org.docx4j.wml.TcPr)2 Text (org.docx4j.wml.Text)2 Inline (org.docx4j.dml.wordprocessingDrawing.Inline)1 BinaryPartAbstractImage (org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage)1 CTShd (org.docx4j.wml.CTShd)1 Highlight (org.docx4j.wml.Highlight)1