How to use Preview version of office-js Excel API?

≡放荡痞女 提交于 2020-06-18 02:50:15

问题


I want to use Preview features of office-js Excel API (specifically DataValidation).

This page says that I should use Beta version of the library and they provide a link but I have no idea what to do with it.

What I did so far:
I have added the js path to index.html.
I copied types from ts file to file in node_modules.

But it doesn't seem like a good solution since whenever I update @types/office-js I would also have to copy source again...


回答1:


in order to use preview Api you only need:

  1. Install latest insiders fast build, AND
  2. refer to the BETA CDN for office.js and if you will use typescript the typescript library: here are the URLs you need to use, as Ricky suggests make sure you add those references to your HTML or JS files in your web app.

https://appsforoffice.microsoft.com/lib/beta/hosted/office.js https://appsforoffice.microsoft.com/lib/beta/hosted/office.d.ts




回答2:


If you are using angular follow these steps.

Refer to the beta office js cdn.

<script src="https://appsforoffice.microsoft.com/lib/beta/hosted/office.js" type="text/javascript"></script>

If you need type definition for beta version, install this.

npm install --save-dev @types/office-js-preview

If you were already using the production version, uninstall it:

npm uninstall --save-dev @types/office-js

Mention the following type in tsconfig.app.json like this (if types is already empty).

"types": ["office-js-preview"]


来源:https://stackoverflow.com/questions/51441910/how-to-use-preview-version-of-office-js-excel-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!