Search in sources :

Example 1 with FldChar

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

the class Docx4J_例子2 method addFieldBegin.

public void addFieldBegin(ObjectFactory factory, P paragraph) {
    R run = factory.createR();
    FldChar fldchar = factory.createFldChar();
    fldchar.setFldCharType(STFldCharType.BEGIN);
    run.getContent().add(fldchar);
    paragraph.getContent().add(run);
}
Also used : R(org.docx4j.wml.R) FldChar(org.docx4j.wml.FldChar)

Example 2 with FldChar

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

the class Docx4J_简单例子 method addFieldEnd.

public void addFieldEnd(ObjectFactory factory, P paragraph) {
    FldChar fldcharend = factory.createFldChar();
    fldcharend.setFldCharType(STFldCharType.END);
    R run3 = factory.createR();
    run3.getContent().add(fldcharend);
    paragraph.getContent().add(run3);
}
Also used : R(org.docx4j.wml.R) FldChar(org.docx4j.wml.FldChar)

Example 3 with FldChar

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

the class Docx4J_简单例子2 method addFieldEnd.

public void addFieldEnd(ObjectFactory factory, P paragraph) {
    FldChar fldcharend = factory.createFldChar();
    fldcharend.setFldCharType(STFldCharType.END);
    R run3 = factory.createR();
    run3.getContent().add(fldcharend);
    paragraph.getContent().add(run3);
}
Also used : R(org.docx4j.wml.R) FldChar(org.docx4j.wml.FldChar)

Example 4 with FldChar

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

the class AddingPageNrToFooter method addFieldEnd.

/**
 * Every fields needs to be delimited by complex field characters. This method
 * adds the delimiter that follows the actual field to the given paragraph.
 * @param paragraph
 */
private static void addFieldEnd(P paragraph) {
    FldChar fldcharend = factory.createFldChar();
    fldcharend.setFldCharType(STFldCharType.END);
    R run3 = factory.createR();
    run3.getContent().add(fldcharend);
    paragraph.getContent().add(run3);
}
Also used : R(org.docx4j.wml.R) FldChar(org.docx4j.wml.FldChar)

Example 5 with FldChar

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

the class AddingTableOfContent method addFieldBegin.

/**
 *  每个域都需要用复杂的域字符来确定界限. 本方法向给定段落添加在真正域之前的界定符.
 *
 *  再一次以创建一个可运行块开始, 然后创建一个域字符来标记域的起始并标记域是'脏的'因为我们想要
 *  在整个文档生成之后进行内容更新.
 *  最后将域字符转换成JAXB元素并将其添加到可运行块, 然后将可运行块添加到段落中.
 *
 *  @param paragraph
 */
private static void addFieldBegin(P paragraph) {
    R run = factory.createR();
    FldChar fldchar = factory.createFldChar();
    fldchar.setFldCharType(STFldCharType.BEGIN);
    fldchar.setDirty(true);
    run.getContent().add(getWrappedFldChar(fldchar));
    paragraph.getContent().add(run);
}
Also used : R(org.docx4j.wml.R) FldChar(org.docx4j.wml.FldChar)

Aggregations

FldChar (org.docx4j.wml.FldChar)11 R (org.docx4j.wml.R)11 Text (org.docx4j.wml.Text)1