wordpress hit counter
Header and Footer section in SpreadsheetML - OpenXML Developer - Blog - OpenXML Developer

Header and Footer section in SpreadsheetML

Blog

Samples, Demos, and Reference Articles

Header and Footer section in SpreadsheetML

Rate This
  • Comments 1

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>&amp;CThis is odd page header</oddHeader>

    <oddFooter>&amp;CThis is odd page footer</oddFooter>

    <evenHeader>&amp;CThis is even page header</evenHeader>

    <evenFooter>&amp;CThis is even page footer</evenFooter>

    <firstHeader>&amp;CThis is First page header</firstHeader>

    <firstFooter>&amp;CThis is first page footer</firstFooter>

  </headerFooter>

 

 

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 –

  • The <oddHeader> element indicates the text/picture for the odd header pages of the Spreadsheet document.
  • The <oddFooter> element indicates the text/picture for the odd footer pages of the Spreadsheet document.
  • The <evenHeader> element indicates the text/picture for the even header pages of the spreadsheet document.
  • The <evenFooter> element indicates the text/picture for the even footer pages of the spreadsheet document.
  • The <firstHeader> element indicates the text/picture for the first header page of the spreadsheet document.
  • The <firstFooter> element indicates the text/picture for the first footer page of the spreadsheet document.

 

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.

·         &amp;C ---code for center section of header/footer

·         &amp;L -- code for left section of header/footer

·         &amp;R -- code for right section of header/footer

·         &amp;P - code for current page #

·         &amp;K - code for "text font color"

·         &amp;S - code for "text strikethrough" on / off

·         &amp;X - code for "text super script" on / off

·         &amp;Y - code for "text subscript" on / off

·         &amp;N - code for "total pages"

·         &amp;D - code for "date"

·         &amp;T - code for "time"

·         &amp;G - code for "picture as background"

·         &amp;U - code for "text single underline"

·         &amp;E - code for "double underline"

·         &amp;Z - code for "this workbook's file path"

·         &amp;F - code for "this workbook's file name"

·         &amp;A - code for "sheet tab name"

·         &amp;B – code for "bold font style".

·         &amp;I – code for "italic font style"

·         &amp;"-,Bold Italic" code for "bold italic font style"

·         &amp;O - code for "outline style"

·         &amp;H - code for "shadow style" and more…

For further predefined values and details on styles of header/footer, refer Open XML specification document.

 

 

  • i am trying to add image to header/footer  but word fails to open. My images are stored under media folder. and i am using rIdx to reference to image
Page 1 of 1 (1 items)