use of org.docx4j.relationships.Relationship in project docx4j-template by vindell.
the class Docx4J_简单例子 method createTextHeaderPart.
// 文字页面
public Relationship createTextHeaderPart(WordprocessingMLPackage wordprocessingMLPackage, MainDocumentPart t, ObjectFactory factory, String content, JcEnumeration jcEnumeration) throws Exception {
HeaderPart headerPart = new HeaderPart();
Relationship rel = t.addTargetPart(headerPart);
headerPart.setJaxbElement(getTextHdr(wordprocessingMLPackage, factory, headerPart, content, jcEnumeration));
return rel;
}
use of org.docx4j.relationships.Relationship in project docx4j-template by vindell.
the class Docx4J_简单例子 method createTextFooterPart.
// 文字页脚
public Relationship createTextFooterPart(WordprocessingMLPackage wordprocessingMLPackage, MainDocumentPart t, ObjectFactory factory, String content, JcEnumeration jcEnumeration) throws Exception {
FooterPart footerPart = new FooterPart();
Relationship rel = t.addTargetPart(footerPart);
footerPart.setJaxbElement(getTextFtr(wordprocessingMLPackage, factory, footerPart, content, jcEnumeration));
return rel;
}
use of org.docx4j.relationships.Relationship in project docx4j-template by vindell.
the class Docx4J_简单例子 method main.
public static void main(String[] args) throws Exception {
Docx4J_简单例子 t = new Docx4J_简单例子();
WordprocessingMLPackage wordMLPackage = t.createWordprocessingMLPackage();
MainDocumentPart mp = wordMLPackage.getMainDocumentPart();
ObjectFactory factory = Context.getWmlObjectFactory();
// 页眉
Relationship relationship = t.createHeaderPart(wordMLPackage, mp, factory);
t.createHeaderReference(wordMLPackage, mp, factory, relationship);
t.addParagraphTest(wordMLPackage, mp, factory);
t.addPageBreak(wordMLPackage, factory);
// 页脚
t.createNormalTableTest(wordMLPackage, mp, factory);
relationship = t.createFooterPageNumPart(wordMLPackage, mp, factory);
t.createFooterReference(wordMLPackage, mp, factory, relationship);
t.saveWordPackage(wordMLPackage, new File("f:/saveFile/temp/s_simple.docx"));
}
use of org.docx4j.relationships.Relationship in project docx4j-template by vindell.
the class Docx4J_简单例子 method createHeaderPart.
// 图片页眉
public Relationship createHeaderPart(WordprocessingMLPackage wordprocessingMLPackage, MainDocumentPart t, ObjectFactory factory) throws Exception {
HeaderPart headerPart = new HeaderPart();
Relationship rel = t.addTargetPart(headerPart);
// After addTargetPart, so image can be added properly
headerPart.setJaxbElement(getHdr(wordprocessingMLPackage, factory, headerPart));
return rel;
}
use of org.docx4j.relationships.Relationship in project docx4j-template by vindell.
the class Docx4J_简单例子2 method createTextFooterPart.
// 文字页脚
public Relationship createTextFooterPart(WordprocessingMLPackage wordprocessingMLPackage, MainDocumentPart t, ObjectFactory factory, String content, JcEnumeration jcEnumeration) throws Exception {
FooterPart footerPart = new FooterPart();
Relationship rel = t.addTargetPart(footerPart);
footerPart.setJaxbElement(getTextFtr(wordprocessingMLPackage, factory, footerPart, content, jcEnumeration));
return rel;
}
Aggregations