Header and Footer Override Scenarios
In Microsoft Word, by default, every document has at least one header, even if you do not make the header visible by adding text or images in the header. You should make yourself thoroughly familiar with how headers work in Word before attempting to use visible headers and footers in inserted templates. Throughout this document, what is true of headers is equally true of footers.
Content Merging Basics
Every Microsoft Word document has at least one section. When you use the INSERT instruction to merge one document's contents into another's contents, at document assembly , HotDocs seamlessly merges the contents of the inserted "child" document into the section of the "parent" document where you use the INSERT instruction:
The only parent section contents involved in the merger of the two documents is the parent section where you place the INSERT instruction.
- If you have a single section in a child document, then HotDocs merges the contents of the single child section between the contents of the parent section before and after the INSERT instruction
- If you have a child document with multiple sections, HotDocs merges the content of the first child section with the content of the parent section prior to the INSERT instruction, and also merges the content of the last child section with the content of the same parent section at the point just following the INSERT instruction
In either case, HotDocs assembles the parent document until it encounters the INSERT instruction. The INSERT instruction tells HotDocs to pause assembly of the parent document while it assembles the child document and then inserts the child document’s contents into the parent document before finishing assembling the part of the parent document that follows the insert instruction.
Because HotDocs merges the contents of the child document into a single section of the parent document, the merging of these two documents is not merely additive in the sense of adding the number of child sections to the number of parent sections in the final document. Rather, the number of sections in the assembled document equals the number of parent sections plus the merger of the number of child sections into the parent section where you placed the INSERT instruction. In other words, if you have a parent document with X number of sections, and a child document with Y number of sections, this merge behavior can be restated with the following formula: X + Y-1, because the first and last sections of the child document merge with the parent section hosting the INSERT instruction.
When you use the INSERT instruction, HotDocs always follows the content merging rules outlined above. The only aspect of the INSERT at issue is which headers HotDocs applies to the sections of merged contents, and which headers HotDocs overrides.
Factors Affecting Which Headers HotDocs Overrides
Every section of a Word document has a header, visible or not. When you use the INSERT instruction in a parent template, a conflict develops as to which header should apply to the section of the assembled document where the merger of the two documents occurs—the parent template's section header, or that of the inserted child template.
When you use the INSERT instruction, there are two primary factors that affect how HotDocs processes the instruction:
- The number of sections (or section breaks) in the child template
- Which INSERT options you use
Number of Sections and Section Breaks in the Child Template
Every Word document has at least a single section. A single section has no section break. The number of sections (one, or more than one section) and section breaks (none, or at least one section break) in a child template determines whether the parent section where you place the INSERT instruction:
- Remains a single section
- Becomes two or more sections
Single Section Child (No Section Break in Template)
When you insert a child template that has no section break into a parent template, the parent template section where you place the INSERT instruction remains a single section; therefore, HotDocs only needs to resolve the conflict between the single header of the parent section and the single header of the child template. How HotDocs resolves the conflict depends on the INSERT instruction options you use (see below).
Multiple Section Child (At Least One Section Break in Template)
Where the child template has at least one section break (hence at least two sections), HotDocs effectively divides the parent template section (let’s call it section A) at the point of the INSERT instruction. Because of this division, HotDocs must separately handle the conflict between the header defined in the parent section and the headers defined (respectively) in the first section and the last section of the child document.
HotDocs merges the assembled child template's sections between the two parts of the parent section as follows:
Parent section A (before INSERT)+ First Child section
<Child section break>
Additional Child sections
<Last Child section break>
Last Child section + Parent section A (after INSERT)
HotDocs resolves any conflict with the parent section's header and the header of the first child section separately from any conflict with the parent section's header and the header of the last child header. These conflict resolutions depend on two factors:
- The document type of the templates involved—DOCX or RTF
- Whether you use the default INSERT instruction, or whether you use the KEEP HEADER option
Your INSERT Options
You have two basic choices when using the INSERT instruction:
- Use the default INSERT instruction—«INSERT "childname.docx"»
- Use the INSERT