There is a time for all good things to come to an end, and the time has come to shut down OpenXmlDeveloper.org.
Screen-casts and blog posts: Content on OpenXmlDeveloper.org will be moving to EricWhite.com.
Forums: We are moving the forums to EricWhite.com and StackOverflow.com. Please do not post in the forums on OpenXmlDeveloper.org. Instead, please post in the forums at EricWhite.com or at StackOverflow.com.
Please see this blog post for more information about my plans moving forward. Cheers, Eric
Article by Sheela E.N, Sonata Software Limited
This article explains how header and footer details and the style applied are stored in SpreadsheetML document and the options that are available in Office Open XML file format to apply header, footer in SpreadsheetML document.
When applying header/footer to SpreadsheetML Document, there is an option to apply different header/footer to first page and to even/odd pages of the document.
In the below sample, different header/footer is applied for first page and even/odd pages.
The header and footer data along with the style applied are stored in SheetN.xml file as –
<headerFooter differentOddEven="1" differentFirst="1">
<oddHeader>&CThis is odd page header</oddHeader>
<oddFooter>&CThis is odd page footer</oddFooter>
<evenHeader>&CThis is even page header</evenHeader>
<evenFooter>&CThis is even page footer</evenFooter>
<firstHeader>&CThis is First page header</firstHeader>
<firstFooter>&CThis is first page footer</firstFooter>
The <headerFooter> element has the following main attributes –
· The differentFirst with value of “1” or “true” indicates that the header and footer are different for the first page of the Spreadsheet document and the value for it is stored in <firstHeader> and <firstFooter> elements respectively.
· The differentOddEven with value of “1” or “true” indicates that different odd and even page header/footer is applied to the Spreadsheet document. The attributes <oddHeader>/<oddFooter> and <evenHeader>/<evenFooter>specify page header and footer values for odd and even pages. If differentOddEven is set to “false” or “0”, then the values present for the attributes of <oddHeader>/<oddFooter> is considered and over-ridden by the values specified for the attributes of <evenHeader>/<evenFooter>.
The <headerFooter> element has the following child elements –
If a picture is applied for header/footer, the same is mentioned along with header/footer elements and the picture will be stored in separate folder (media) and is linked with relationship ID.
These child elements of <headerFooter> element will have the predefined set of entities to define the location and style for the content of header/footer.
· &C ---code for center section of header/footer
· &L -- code for left section of header/footer
· &R -- code for right section of header/footer
· &P - code for current page #
· &K - code for "text font color"
· &S - code for "text strikethrough" on / off
· &X - code for "text super script" on / off
· &Y - code for "text subscript" on / off
· &N - code for "total pages"
· &D - code for "date"
· &T - code for "time"
· &G - code for "picture as background"
· &U - code for "text single underline"
· &E - code for "double underline"
· &Z - code for "this workbook's file path"
· &F - code for "this workbook's file name"
· &A - code for "sheet tab name"
· &B – code for "bold font style".
· &I – code for "italic font style"
· &"-,Bold Italic" code for "bold italic font style"
· &O - code for "outline style"
· &H - code for "shadow style" and more…
For further predefined values and details on styles of header/footer, refer Open XML specification document.