Manish Bafna
Manish Bafna

Reputation: 1

Office Add-in: Word 2013 - InsertHTML not working

We are trying to insert HTML in Word. It is working with 2016, but the add-in publish got rejected because it is not working in Word 2013. Not able to install 2013. Any help is appreciated. Here is our code:

Word.run(function (context) {
     const range = context.document.getSelection();
     range.insertHtml(richText, Word.InsertLocation.end);
     return context.sync().then(function () {});
})

Upvotes: 0

Views: 127

Answers (1)

Rick Kirkham
Rick Kirkham

Reputation: 9674

You need to use Requirement Sets to either specify in the manifest that the add-in is not supported on Office 2013, or use the isSetSupported method to give Office 2013 users an alternate experience of your add-in that does not use any APIs that are not supported on Office 2013. For more details, see Office versions and requirement sets and Specify Office hosts and API requirements.

UPDATE 4/10/20: To ignore Office versions that do not support the APIs that you need, you need to find the earliest Requirement Set that includes the API. Since you are working with Word, you need to look at these 3 articles and find the earliest Requirement Set that includes the insertHtml method:

Word API 1.1 Requirement Set

Word API 1.2 Requirement Set

Word API 1.3 Requirement Set

After you've done that, follow the instructions in Set the Requirements element in the manifest to specify in your manifest the earliest requirement set that you need.

Upvotes: 1

Related Questions