I've been attempting to insert OOXML into the body content of word documents via the office-js insertOoXML()
method. I've even tried the simplest of implementations (thinking I was doing something incorrect when attempting to replace fieldCodes in the XML itself) and all result in this Error: unknown
response after saying its "inserting":
Error: unknown at new r (word-web-16.00.js:21) at i.c.processRequestExecutorResponseMessage (word-web-16.00.js:21) at word-web-16.00.js:21
To reproduce - here's a simple example of getting the body OoXML and attempting to replace it back in:
Word.run(async context => {
const OOXML = context.document.body.getOoxml();
await context.sync();
context.document.body.insertOoxml(OOXML.value, Word.InsertLocation.replace);
await context.sync().catch(console.error);
});
With the example above there is no chance that the OoXML is malformed as it's the direct result that office-js has returned to the client.
Any help with this would be much appreciated as manipulating Field Codes (as there's no native support) is a must for my Add-In.
InsertOoxml is now working as it should for me.
Microsoft appears to have fixed this problem (Although I have not yet had official confirmation via my support case)
Thanks to Juan Balmori and those working on the extensibility team for getting this fixed up.
J.