0
votes

I am developing a Word add-in with Office.js that utilizes ContentControl.insertText. According to the documentation, this method is provided by WordApi requirement set 1.1, which is supported in Office Online. Furthermore, the documentation for ContentControls lists Office Online as being supported and does not mention any exceptions when it comes to using that particular method.

That said, when I run the add-in in native Word 2016, everything works fine, but when I run it in the Word Online environment, it fails with the following exception:

code:"NotAllowed"
errorLocation:"ContentControl.insertText"
message:"The action isn’t supported in Word Online. Check the OfficeExtension.Error.debugInfo for more information."

For reference, I am using it like so:

control.insertText(heading.Text, 'Replace');

I also tried running the example provided in the documentation, with the same results: it works in Word 2016, but fails with the above exception in Word Online.

Has anyone been able to successfully insert text into a ContentControl in the Office Online environment? If not, are there plans for this functionality to be supported?

Any input or clarification would be most appreciated! Thanks!

1

1 Answers

0
votes

I'm an engineer from MS. There are some cases which contentControl.insertText is not allowed.

I think the cause of your case is that there is more than one paragraphs in the heading.text and you try to insert heading.text into a inline content control.

The inline content control means that the content control just some part of a paragraph.

In order to make sure the root cause of your scenario, could you share me the doc and the script code.