Support components in headers/footers?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Support components in headers/footers?

Jason Harrop
Administrator
tinne's post content-controls-in-header-footer
raises the interesting question of whether component insert should be supported in headers & footers.

Per the OpenDoPE convention, an sdt which is to be replaced by the insertion of another docx will have:

            <w:sdtPr>

              <w:tag w:val="od:component=comp1"/> 

            </w:sdtPr>

The URL of the docx to be inserted is specified in the components Custom XML Part:

      <components xmlns="http://opendope.org/components">

        <component id="comp1" iri="http://www.foo.com/component-subdoc.docx"/>

      </components>

docx4j implements this by replacing the component with an altChunk tag.

The OpenXML spec says that an altChunk can have any of the following parent elements:  body (§2.2.2); comment (§2.13.4.2); docPartBody (§2.12.6); endnote (§2.11.2); footnote (§2.11.10); ftr (§2.10.3); hdr (§2.10.4); tc (§2.4.62); txbxContent (§2.17.1.1)

So in principle, a component could be inserted in an header/footer.  And testing in Word 2007, you can use a docx altChunk in a header; it just includes the contents of the altChunk docx's document.xml (ie ignores any header it might have!)

So I guess we should allow it, especially since you may want to insert corporate branding via header/footer, and a component is a good way to do this.