9 wordprocessing ml subject - headers and footers

22
Components of WordprocessingML Main Document Paragraphs & Rich Formatting Runs Run Content Tables Custom Markup Sections Styles Paragraph Character Numbering Table Document Defaults Fonts Numbering Headers/Footers Footnotes/Endnotes Glossary Document Annotations Comments Revisions Bookmarks Mail Merge Document Settings Web Settings Compatibility Settings Fields & Hyperlinks Odds & Ends (Textboxes, Subdocuments, Extensibility) Ecma/TC45/2006/115 (Rev.)

Transcript of 9 wordprocessing ml subject - headers and footers

Components of WordprocessingML• Main Document• Paragraphs & Rich Formatting

– Runs– Run Content

• Tables• Custom Markup• Sections• Styles

– Paragraph– Character– Numbering– Table– Document Defaults

• Fonts• Numbering• Headers/Footers• Footnotes/Endnotes• Glossary Document• Annotations

– Comments– Revisions– Bookmarks

• Mail Merge• Document Settings

– Web Settings– Compatibility Settings

• Fields & Hyperlinks• Odds & Ends (Textboxes, Subdocuments, Extensibility)

Ecma/TC45/2006/115 (Rev.)

WordprocessingML – Headers and Footers

Headers and Footers

• Headers and footers are ‘stories’ in a WordprocessingML document

• Like the main document story, they can contain text, graphics or data (such as page number, date, document title, and so on)– There is no fundamental restriction to the

contents of the header/footer story

Headers and Footers

• What makes these unique is where they are displayed in page view:– Headers appear above the top of the main

document story’s text extent– Footers appear below the bottom of the main

document story’s text extent• Headers and footers are linked to the main

story as a section-level property in WordprocessingML

Header Part

• Stored in multiple header parts, each of which has an explicit relationship from the document part– The explicit relationship tells the consumer the

section(s) to which a particular header is anchored

Header Part

• Relationship type: http://schemas.openxmlformats.org/wordprocessingml/2006/header

• Content type: vnd-openxmlformats.officedocument.wordprocessingml-header+xml

Footer Part

• Stored in multiple footer parts, each of which has an explicit relationship from the document part– The explicit relationship tells the consumer the

section(s) to which a particular footer is anchored

Header Part

• Relationship type: http://schemas.openxmlformats.org/wordprocessingml/2007/footer

• Content type: vnd-openxmlformats.officedocument.wordprocessingml-footer+xml

Using a Header or Footer

• Using headers and footers in WordprocessingML consists of two parts:– The section properties (referencing the header)– The part (the contents of the header)

• Only if both are present is the header or footer valid

Section Properties

• Header or footer parts must be associated with a section(s) within the document– Otherwise, they wouldn’t be displayed anywhere

• Each section can contain three types of headers or footers (declared on the reference):– First page – displayed on page one– Odd page – displayed on pages 1(if no pg

one),3,5,7…– Even page – displayed on 2,4,6…

Section Properties

• The odd page header is the ‘default’ header– If there’s explicitly no page one header, the odd

page header is displayed there– If there’s explicitly no even page header, the odd

page header is displayed there

Header/Footer References

• References to a header or footer are made via the headerReference and footerReference elements– Each has an attribute with the explicit relationship

ID to the appropriate part• Saying nothing about each type is slightly

more complicated, though – we’ll come back to that

Header/Footer References Example

Each target specifies the type of header for the section

Headers and Footers

• A WordprocessingML header and footers consists of one component:

• Content– Any block-level WordprocessingML content

Headers and Footers

• The root element for the header part is the hdr element

• The root element for the header part is the ftr element

• Beyond that, this is just another text story

Header Example

Header content

• You’ll notice the paragraph style is called Header – that’s not a requirement

Header Root Element

Multiple Sections

• Documents can have more than one section• Each section can define up to three headers

and footers (as seen before)

Multiple Sections

• To optimize the output, we only write out headers and footers when they are different:

• Default (omit a headerReference element): – Section will inherit the previous header and footer

references• Override:

– Section specifies header and footer references

Multiple Sections

• How do we know which ones to override?

• The header reference tells us the type for each header – if one is missing, we don’t use it.

Multiple Section Example

No headers or footers

specified=

Inherit all headers and

footers

Empty Header or Footer

• What if you want an empty header or footer?– Omitting the reference inherits, so that’s no good.– To do this, a header or footer reference must be

made to a NULL target

<Relationship Type=“http://schemas.openxmlformats.org/wordprocessingml/2006/header” target=“NULL” />

Null target part == no header

Disclaimer

This presentation is for informational purposes only, and should not be relied upon as a substitute or replacement for Microsoft formal file format documentation, which is available at the following website: https://msdn.microsoft.com/en-us/library/cc313118(v=office.12).aspx. Any views or opinions presented in this material are solely those of the author and do not necessarily represent those of Microsoft. Microsoft disclaims all liability for mistakes or inaccuracies in this presentation.