本文整理匯總了Java中org.docx4j.wml.HeaderReference類的典型用法代碼示例。如果您正苦於以下問題:Java HeaderReference類的具體用法?Java HeaderReference怎麽用?Java HeaderReference使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
HeaderReference類屬於org.docx4j.wml包,在下文中一共展示了HeaderReference類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createHeaderReference
import org.docx4j.wml.HeaderReference; //導入依賴的package包/類
public void createHeaderReference(
WordprocessingMLPackage wordprocessingMLPackage,
MainDocumentPart t, ObjectFactory factory, Relationship relationship)
throws InvalidFormatException {
List<SectionWrapper> sections = wordprocessingMLPackage
.getDocumentModel().getSections();
SectPr sectPr = sections.get(sections.size() - 1).getSectPr();
// There is always a section wrapper, but it might not contain a sectPr
if (sectPr == null) {
sectPr = factory.createSectPr();
t.addObject(sectPr);
sections.get(sections.size() - 1).setSectPr(sectPr);
}
HeaderReference headerReference = factory.createHeaderReference();
headerReference.setId(relationship.getId());
headerReference.setType(HdrFtrRef.DEFAULT);
sectPr.getEGHdrFtrReferences().add(headerReference);
}
示例2: createHeaderReference
import org.docx4j.wml.HeaderReference; //導入依賴的package包/類
public void createHeaderReference(
WordprocessingMLPackage wordprocessingMLPackage,
MainDocumentPart t, ObjectFactory factory, Relationship relationship)
throws InvalidFormatException {
List<SectionWrapper> sections = wordprocessingMLPackage
.getDocumentModel().getSections();
SectPr sectPr = sections.get(sections.size() - 1).getSectPr();
// There is always a section wrapper, but it might not contain a sectPr
if (sectPr == null) {
sectPr = factory.createSectPr();
t.addObject(sectPr);
sections.get(sections.size() - 1).setSectPr(sectPr);
}
HeaderReference headerReference = factory.createHeaderReference();
headerReference.setId(relationship.getId());
headerReference.setType(HdrFtrRef.DEFAULT);
sectPr.getEGHdrFtrReferences().add(headerReference);
}
示例3: createHeaderReference
import org.docx4j.wml.HeaderReference; //導入依賴的package包/類
public static void createHeaderReference(
WordprocessingMLPackage wordprocessingMLPackage,
Relationship relationship )
throws InvalidFormatException {
List<SectionWrapper> sections = wordprocessingMLPackage.getDocumentModel().getSections();
SectPr sectPr = sections.get(sections.size() - 1).getSectPr();
// There is always a section wrapper, but it might not contain a sectPr
if (sectPr==null ) {
sectPr = objectFactory.createSectPr();
wordprocessingMLPackage.getMainDocumentPart().addObject(sectPr);
sections.get(sections.size() - 1).setSectPr(sectPr);
}
HeaderReference headerReference = objectFactory.createHeaderReference();
headerReference.setId(relationship.getId());
headerReference.setType(HdrFtrRef.DEFAULT);
sectPr.getEGHdrFtrReferences().add(headerReference);// add header or
// footer references
}
示例4: createHeaderReference
import org.docx4j.wml.HeaderReference; //導入依賴的package包/類
private void createHeaderReference(WordprocessingMLPackage wordprocessingMLPackage, Relationship relationship)
throws InvalidFormatException {
List<SectionWrapper> sections = wordprocessingMLPackage.getDocumentModel().getSections();
SectPr sectPr = sections.get(sections.size() - 1).getSectPr();
// There is always a section wrapper, but it might not contain a sectPr
if (sectPr == null) {
sectPr = factory.createSectPr();
wordprocessingMLPackage.getMainDocumentPart().addObject(sectPr);
sections.get(sections.size() - 1).setSectPr(sectPr);
}
HeaderReference headerReference = factory.createHeaderReference();
headerReference.setId(relationship.getId());
headerReference.setType(HdrFtrRef.DEFAULT);
sectPr.getEGHdrFtrReferences().add(headerReference);
}