OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
659 stars 94 forks source link

Cannot get ContentControl content by calling getOoxml() in specific scenario #2708

Closed andreipaun closed 3 months ago

andreipaun commented 2 years ago

Message from office-js bot: We’re closing this issue because it has been inactive for a long time. We’re doing this to keep the issues list manageable and useful for everyone. If this issue is still relevant for you, please create a new issue. Thank you for your understanding and continued feedback.

Discovered a usecase for which a call to contentControl.getRange("content").getOoxml() ends up in a RichApiError. Below you will find attached a simple document created to exhibit the problem as well as a Scriptlab gist.

Expected Behavior

A call to getOoxml() should not fail.

Current Behavior

The call to getOoxml() should not fail.

Steps to Reproduce, or Live Example

  1. Use the attached document that has three nested content controls labeled cc1, cc2 and cc3 (cc1 being the outtermost content control). cc3 contains a table and an empty paragraph.
  2. Run the attached scriptlab gist and press on the 'Show me the bug!' button.
  3. An error occurs when calling cc2.getRange("content").getOoxml() instead of displaying a valid Ooxml string.

Context

We are working on an OfficeJs Word add-in and we rely heavily on being able to get and insert ooxml content to and from content controls. These types of bugs have a critical impact on our ability to deliver something solid to our customers.

Your Environment

Gist URL

duby.docx

JinghuiMS commented 2 years ago

Thanks for reporting this issue. It has been put on our backlog<Bug#6255786> for internal track. We unfortunately have no timelines to share at this point.

jipyua commented 2 months ago

hi @andreipaun I tried on latest build 16.0.15731 and this issue doesn't reproduce anymore, now the getOoxml() API is successfully returning the ooxml content of the second content control. please update your office to latest M365 version and have a try. thanks.