use of org.docx4j.wml.Text in project docx4j-template by vindell.
the class Docx4J_简单例子 method getTextHdr.
public Hdr getTextHdr(WordprocessingMLPackage wordprocessingMLPackage, ObjectFactory factory, Part sourcePart, String content, JcEnumeration jcEnumeration) throws Exception {
Hdr hdr = factory.createHdr();
P headP = factory.createP();
Text text = factory.createText();
text.setValue(content);
R run = factory.createR();
run.getContent().add(text);
headP.getContent().add(run);
PPr pPr = headP.getPPr();
if (pPr == null) {
pPr = factory.createPPr();
}
Jc jc = pPr.getJc();
if (jc == null) {
jc = new Jc();
}
jc.setVal(jcEnumeration);
pPr.setJc(jc);
headP.setPPr(pPr);
hdr.getContent().add(headP);
return hdr;
}
use of org.docx4j.wml.Text in project docx4j-template by vindell.
the class Docx4J_简单例子 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);
}
use of org.docx4j.wml.Text 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);
}
use of org.docx4j.wml.Text 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);
}
use of org.docx4j.wml.Text 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));
}
Aggregations