A family of Microsoft word processing software products for creating web, email, and print documents.
See Content Controls for the Mac by John Korchok.
You may want to see if you can be a beta-tester for his Add-In.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am building a word addin and have to use ooxml because the api does not support picture content controls. We are replacing old vba macros and do not have the luxury of just supporting richtext content controls. I am using
https://appsforoffice.microsoft.com/lib/1/hosted/office.js
Calling
xml = context.document.sections.getFirst().getHeader(Word.HeaderFooterType.evenPages).getOoxml();
or
xml = context.document.sections.getFirst().getHeader(Word.HeaderFooterType.firstPage).getOoxml();
and then calling
context.document.sections.getFirst().getHeader(Word.HeaderFooterType.evenPages).insertOoxml(xml);
or
context.document.sections.getFirst().getHeader(Word.HeaderFooterType.firstPage).insertOoxml(xml);
throws the following error.
name: 'RichApi.Error', code: 'GeneralException', traceMessages: {}, innerError: null, debugInfo: {code: 'GeneralException', message: 'GeneralException', errorLocation: 'Body.insertOoxml', statement: 'var insertOoxml = header.insertOoxml(...);', surroundingStatements: {0: 'var v = context.root._getObjectByReferenceId("024!00000009");', 1: 'var first = v.getFirst();', 2: '// Instantiate {first}', 3: 'var header = first.getHeader(...);', 4: '// Instantiate {header}', ...}, ...}, httpStatusCode: 500, data: undefined
I have not touched the xml just get and insert and it says the xml is invalid. This works fine for primary headers just not evenPages and firstPage headers.
Why would the api return invalid xml, the error tells me nothing useful.
If headers are defined or not makes no difference.
A family of Microsoft word processing software products for creating web, email, and print documents.
See Content Controls for the Mac by John Korchok.
You may want to see if you can be a beta-tester for his Add-In.