Recently, I had a need to download the preview of the OfficeJS API for testing in an offline environment. The primary (and preferred) way to access the preview beta library is to point to it on the CDN via your HTML, like this:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=Edge" /> | |
<title>My OfficeJS Add-in</title> | |
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js" type="text/javascript"></script> | |
<!–<script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js" type="text/javascript"></script>–> | |
<!– PREVIEW API CDN –> | |
<script src="https://appsforoffice.microsoft.com/lib/preview/hosted/Office.js" type="text/javascript"></script> | |
</head> |
However, if you need to download this for use offline in testing, you can actually download it using Node Package Manager. All you need is this command:
npm install @microsoft/office-js@beta
I was able to do my testing as if I were online with the CDN, so all was good. Happy coding!