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);
}
use of org.docx4j.wml.R 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);
}
use of org.docx4j.wml.R in project docx4j-template by vindell.
the class Docx4J_简单例子 method addPageTextField.
private void addPageTextField(ObjectFactory factory, P paragraph, String value) {
R run = factory.createR();
Text txt = new Text();
txt.setSpace("preserve");
txt.setValue(value);
run.getContent().add(txt);
paragraph.getContent().add(run);
}
use of org.docx4j.wml.R in project docx4j-template by vindell.
the class Docx4J_简单例子 method addParagraphTest.
public void addParagraphTest(WordprocessingMLPackage wordMLPackage, MainDocumentPart t, ObjectFactory factory) throws Exception {
RPr titleRPr = getRPr(factory, "黑体", "000000", "28", STHint.EAST_ASIA, true, false, false, false);
RPr boldRPr = getRPr(factory, "宋体", "000000", "22", STHint.EAST_ASIA, true, false, false, false);
RPr fontRPr = getRPr(factory, "宋体", "000000", "20", STHint.EAST_ASIA, false, false, false, false);
P paragraph = factory.createP();
setParagraphAlign(factory, paragraph, JcEnumeration.CENTER);
Text txt = factory.createText();
txt.setValue("七年级上册Unit2 This is just a test. sectionA测试卷答题卡");
R run = factory.createR();
run.getContent().add(txt);
run.setRPr(titleRPr);
paragraph.getContent().add(run);
t.addObject(paragraph);
paragraph = factory.createP();
setParagraphAlign(factory, paragraph, JcEnumeration.CENTER);
txt = factory.createText();
txt.setValue("班级:________ 姓名:________");
run = factory.createR();
run.getContent().add(txt);
run.setRPr(fontRPr);
paragraph.getContent().add(run);
t.addObject(paragraph);
paragraph = factory.createP();
txt = factory.createText();
txt.setValue("一、单选题");
run = factory.createR();
run.getContent().add(txt);
run.setRPr(boldRPr);
paragraph.getContent().add(run);
t.addObject(paragraph);
paragraph = factory.createP();
txt = factory.createText();
txt.setValue("1.下列有关仪器用途的说法错误的是( )");
run = factory.createR();
run.getContent().add(txt);
run.setRPr(fontRPr);
paragraph.getContent().add(run);
t.addObject(paragraph);
paragraph = factory.createP();
txt = factory.createText();
txt.setValue("A.烧杯用于较多量试剂的反应容器");
run = factory.createR();
run.getContent().add(txt);
run.setRPr(fontRPr);
paragraph.getContent().add(run);
t.addObject(paragraph);
paragraph = factory.createP();
txt = factory.createText();
txt.setValue("B.烧杯用于较多量试剂的反应容器");
run = factory.createR();
run.getContent().add(txt);
run.setRPr(fontRPr);
paragraph.getContent().add(run);
t.addObject(paragraph);
paragraph = factory.createP();
txt = factory.createText();
txt.setValue("C.烧杯用于较多量试剂的反应容器");
run = factory.createR();
run.getContent().add(txt);
run.setRPr(fontRPr);
paragraph.getContent().add(run);
t.addObject(paragraph);
paragraph = factory.createP();
txt = factory.createText();
txt.setValue("D.烧杯用于较多量试剂的反应容器");
run = factory.createR();
run.getContent().add(txt);
run.setRPr(fontRPr);
paragraph.getContent().add(run);
t.addObject(paragraph);
}
use of org.docx4j.wml.R 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);
}
Aggregations