Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting OoXml into word throwing Error: Unknown

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.

like image 478
Peak Avatar asked Aug 26 '26 09:08

Peak


1 Answers

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.

like image 159
James Boman Avatar answered Aug 29 '26 00:08

James Boman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!