Search in sources :

Example 21 with R

use of org.docx4j.wml.R 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 22 with R

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

the class Docx4J_简单例子2 method addPageNumberField.

public void addPageNumberField(ObjectFactory factory, P paragraph) {
    R run = factory.createR();
    Text txt = new Text();
    txt.setSpace("preserve");
    txt.setValue("PAGE  \\* MERGEFORMAT ");
    run.getContent().add(factory.createRInstrText(txt));
    paragraph.getContent().add(run);
}
Also used : R(org.docx4j.wml.R) Text(org.docx4j.wml.Text)

Example 23 with R

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

the class Docx4J_简单例子2 method addTotalPageNumberField.

public void addTotalPageNumberField(ObjectFactory factory, P paragraph) {
    R run = factory.createR();
    Text txt = new Text();
    txt.setSpace("preserve");
    txt.setValue("NUMPAGES  \\* MERGEFORMAT ");
    run.getContent().add(factory.createRInstrText(txt));
    paragraph.getContent().add(run);
}
Also used : R(org.docx4j.wml.R) Text(org.docx4j.wml.Text)

Example 24 with R

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

the class Docx4j_创建批注_S3_Test method createRunCommentReference.

public R createRunCommentReference(ObjectFactory factory, BigInteger commentId) {
    R run = factory.createR();
    R.CommentReference commentRef = factory.createRCommentReference();
    run.getContent().add(commentRef);
    commentRef.setId(commentId);
    return run;
}
Also used : R(org.docx4j.wml.R)

Example 25 with R

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

the class Docx4j_创建批注_S3_Test method createCommentRound.

// 创建批注(选定范围)
public void createCommentRound(ObjectFactory factory, P p, String pContent, String commentContent, RPr fontRPr, RPr commentRPr, BigInteger commentId, Comments comments) throws Exception {
    CommentRangeStart startComment = factory.createCommentRangeStart();
    startComment.setId(commentId);
    p.getContent().add(startComment);
    R run = factory.createR();
    Text txt = factory.createText();
    txt.setValue(pContent);
    run.getContent().add(txt);
    run.setRPr(fontRPr);
    p.getContent().add(run);
    CommentRangeEnd endComment = factory.createCommentRangeEnd();
    endComment.setId(commentId);
    p.getContent().add(endComment);
    Comment commentOne = createComment(factory, commentId, "系统管理员", new Date(), commentContent, commentRPr);
    comments.getComment().add(commentOne);
    p.getContent().add(createRunCommentReference(factory, commentId));
}
Also used : CommentRangeEnd(org.docx4j.wml.CommentRangeEnd) Comment(org.docx4j.wml.Comments.Comment) R(org.docx4j.wml.R) Text(org.docx4j.wml.Text) CommentRangeStart(org.docx4j.wml.CommentRangeStart) Date(java.util.Date)

Aggregations

R (org.docx4j.wml.R)93 P (org.docx4j.wml.P)58 Text (org.docx4j.wml.Text)53 PPr (org.docx4j.wml.PPr)23 Jc (org.docx4j.wml.Jc)18 RPr (org.docx4j.wml.RPr)18 Drawing (org.docx4j.wml.Drawing)17 ObjectFactory (org.docx4j.wml.ObjectFactory)17 CTVerticalJc (org.docx4j.wml.CTVerticalJc)16 STVerticalJc (org.docx4j.wml.STVerticalJc)13 FldChar (org.docx4j.wml.FldChar)11 BigInteger (java.math.BigInteger)10 Inline (org.docx4j.dml.wordprocessingDrawing.Inline)10 BinaryPartAbstractImage (org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage)10 Tc (org.docx4j.wml.Tc)10 CTBorder (org.docx4j.wml.CTBorder)8 PBdr (org.docx4j.wml.PPrBase.PBdr)8 Ftr (org.docx4j.wml.Ftr)7 File (java.io.File)6 Tr (org.docx4j.wml.Tr)6