I'm trying to puzzle through how to add a header/footer to a document. Thus far I've figured out the complicated stuff but I'm stuck with something that should be simple: where do I get the rId that I need for the HeaderReference? So far, it looks like my only option is to add the HeaderPart to the MainDocumentPart then getOwningRelationshipPart().getRelationships().getRelationship() and iterate through the list checking for a target whose partName matches my HeaderPart and then getId from that Relationship. This seems more difficult that it should be. I'm sure there's something simpler that I've overlooked. Any hints?