office-js-docs-reference: Accessing firstPage and evenPages headers throw a general exception
Trying to get the firstPage and evenPages header, I get a general exception. Why? How are we supposed to get the data from the various headers and footers when we do not control the structure of the document we are reading? lelsteph
const ooxml: OfficeExtension.ClientResult<string> = reportDoc.sections.items[sectionIndex].getHeader(Word.HeaderFooterType.evenPages).getRange('Content').getOoxml();
await context.sync();
{
"name": "RichApi.Error",
"code": "GeneralException",
"traceMessages": [],
"innerError": null,
"debugInfo": {
"code": "GeneralException",
"message": "GeneralException",
"errorLocation": "Range.getOoxml",
"statement": "range.getOoxml();",
"surroundingStatements": [
"var v = context.root._getObjectByReferenceId(\"t!00000537\");",
"var header = v.getHeader(...);",
"// Instantiate {header}",
"var range = header.getRange(...);",
"// Instantiate {range}",
"// >>>>>",
"range.getOoxml();",
"// <<<<<"
],
"fullStatements": [
"Please enable config.extendedErrorLogging to see full statements."
]
},
"httpStatusCode": 500
}
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 4e387738-e6fd-1a29-d7e4-3cee0ee81593
- Version Independent ID: c88d2c75-ea01-2dba-bbbb-791de41e1837
- Content: Word.Section class - Office Add-ins
- Content Source: docs/docs-ref-autogen/word/word/word.section.yml
- Product: word
- Technology: add-ins
- GitHub Login: @o365devx
- Microsoft Alias: o365devx
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 22 (13 by maintainers)
Thanks for your response and absolutely agree we should all provide the best experience possible to our customers!
Thanks for clarifying. I was thinking that perhaps you wanted to create a section in the document then try to set that section’s header/footer. I’ll dig around a bit more and get back to you.
Also, if any of these features don’t currently exist, you may want to request them on our Ideas site. Or upvote them if they already exist.