I'm sure it should be obvious to me when I look at docs or samples, but I don't see how I can use the API to add a footer to all pages except the first.
I'd appreciate it if someone could point me in the right direction.
HeaderPart header1 = new HeaderPart();
header1.setJaxbElement(getHdr());
Relationship rel1 = wordprocessingMLPackage.getMainDocumentPart().addTargetPart(header1);
HeaderReference headerReference1 = objectFactory.createHeaderReference();
headerReference1.setId(rel1.getId());
headerReference1.setType(HdrFtrRef.DEFAULT);
//add header or footer references
sectPr.getEGHdrFtrReferences().add(headerReference1);
HeaderPart header2= new HeaderPart();
header2.setJaxbElement(objectFactory.createHdr());
Relationship rel2 = wordprocessingMLPackage.getMainDocumentPart().addTargetPart(header2);
HeaderReference headerReference2 = objectFactory.createHeaderReference();
headerReference2.setId(rel2.getId());
headerReference2.setType(HdrFtrRef.FIRST);
//add header or footer references
sectPr.getEGHdrFtrReferences().add(headerReference2);
HeaderPart header1 = new HeaderPart(new PartName("/word/header1.xml"));
HeaderPart header2 = new HeaderPart(new PartName("/word/header2.xml"));
sectPr.setTitlePg(new BooleanDefaultTrue());
Users browsing this forum: Google [Bot] and 62 guests