JFM
JFM

Reputation: 67

'Word' is undefined in office.js Add-in with Word 2013

I'm implementing an Office.js Add-in for Word and it works like a charm in MS Word (Windows 10, 1909 & Office 18.2005.1191.0 (that means the add-in runs in the Edge-browser)) and in the browser on office.com (ie11, chrome, edge, ...)

Now the problem: When I switch to a Windows 10 VM with Office 2013 installed, the add-in loads up, and I can use my Vue.js application in the sidebar, but as soon as the add-in calls the office.js interface await Word.run(...) an error gets thrown with the message 'Word' is undefined.

On the same VM, the same manifest.xml works perfectly fine on office.com in ie11.

Here is my initialize function:

window.Office.initialize = function (reason) {
  new Vue({
    i18n,
    render: h => h(App)
  }).$mount('#app')
}

Here is my polyfill:

import 'promise-polyfill/src/polyfill'
import 'whatwg-fetch'

Here is my script tag from the index.html header

<script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"></script>

Any ideas on what to debug next? Definitely possible that I'm missing something basic. Thanks!! <3 Screenshot of sentry.io event

Upvotes: 1

Views: 415

Answers (1)

JFM
JFM

Reputation: 67

Ok, I think I got it.

Office 2013 isn't compatible with the WordApi 1.1 features I use.

Perpetual versions of Office support requirement sets as follows:

Office 2019 supports WordApi 1.3 and earlier. Office 2016 only supports the WordApi 1.1 requirement set.

Source

I will be adding the following lines to my manifest.xml:

  <Requirements>
  <Sets DefaultMinVersion="1.1">
    <Set Name="WordApi" MinVersion="1.1" />
  </Sets>
</Requirements>
...

Upvotes: 1

Related Questions