Headers and footers
The Import from Word converter supports converting content of Word’s headers and footers into additional HTML.
# Headers and footers format
A single header or footer is represented as an object with single property:
html
: Content of a header or footer.
Following types of headers and footers may be returned as a result of conversion:
Type | Description |
---|---|
Default | Used in place of first, odd and even header/footer if those specific header/footer types are not defined. |
First | Header/footer rendered on the first page of the document. |
Odd | Header/footer rendered on odd-numbered pages. |
Even | Header/footer rendered on even-numbered pages. |
An example Word document with headers and footers and converted result:
// ...rest of the response
"headers" : {
"first": {
"html": "<p style=\"margin-top: 0px; margin-bottom: 0px; line-height: 1\">
<span
style=\"color: #ff0000; font-size: 16px; font-family: Aptos, sans-serif\"
lang=\"en-US\"
>My title page header
</span>
</p>
",
},
"odd": {
"html": "<p style=\"margin-top: 0px; margin-bottom: 0px; line-height: 1\">
<span
style=\"color: #3a7c22; font-size: 16px; font-family: Aptos, sans-serif\"
lang=\"en-US\"
>My odd page header
</span>
</p>
",
},
"even": {
"html": "<p style=\"margin-top: 0px; margin-bottom: 0px; line-height: 1\">
<span
style=\"color: #0f4761; font-size: 16px; font-family: Aptos, sans-serif\"
lang=\"en-US\"
>My even page header
</span>
</p>
",
}
},
"footers": {
"first": {
"html": "<p style=\"margin-top: 0px; margin-bottom: 0px; line-height: 1\">
<span
style=\"color: #ff0000; font-size: 16px; font-family: Aptos, sans-serif\"
lang=\"en-US\"
>My title page footer
</span>
</p>
",
},
"odd": {
"html": "<p style=\"margin-top: 0px; margin-bottom: 0px; line-height: 1\">
<span
style=\"color: #3a7c22; font-size: 16px; font-family: Aptos, sans-serif\"
lang=\"en-US\"
>My odd page footer
</span>
</p>
",
},
"even": {
"html": "<p style=\"margin-top: 0px; margin-bottom: 0px; line-height: 1\">
<span
style=\"color: #0f4761; font-size: 16px; font-family: Aptos, sans-serif\"
lang=\"en-US\"
>My even page footer
</span>
</p>
",
}
}
# Page number and number of pages
Headers and footers in Word document may contain dynamic fields like page number or total number of pages.
Import from Word converter replaces those fields with HTML span elements with special class applied:
- Page number fields are replaced with
<span class="pageNumber"></span>
. - Total number of pages fields are replaced with
<span class="totalPages"></span>
.
This assures compatibility with Export to Word Headers and Footers page numbering and number of pages conversion.
An example Word document, and converted header:
<p>
Page <span class="pageNumber"></span> of <span class="totalPages"></span>
</p>
# Known limitations
- Headers and footers are not compatible with the comments and suggestions collaboration features.
- Due to lack of multi-section support, headers and footers are converted for first encoundered
section with headers or footers defined.