當前位置: 首頁>>代碼示例>>Java>>正文


Java HeaderReference類代碼示例

本文整理匯總了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);
}
 
開發者ID:vindell,項目名稱:docx4j-template,代碼行數:19,代碼來源:Docx4J_例子2.java

示例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);  
}
 
開發者ID:vindell,項目名稱:docx4j-template,代碼行數:19,代碼來源:Docx4J_簡單例子2.java

示例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

}
 
開發者ID:asposemarketplace,項目名稱:Aspose_Java_for_Docx4j,代碼行數:23,代碼來源:Docx4jHeaderCreate.java

示例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);
}
 
開發者ID:nextreports,項目名稱:nextreports-engine,代碼行數:16,代碼來源:DocxExporter.java


注:本文中的org.docx4j.wml.HeaderReference類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。