I am asked the following questions all the time by customers interested in making the jump to Office.js. Therefore, I am providing this FAQ as a primer which usually helps open the door to deeper discussions:
- What is Office.js exactly?
Yes. You can currently install or use an Office application (Word, Excel, PowerPoint and Outlook), on any of these platforms: Windows, Mac, iOS, Android (soon) or Web. There are some restrictions on what is supported and how much of the toolset is available per platform. See this article: Office Add-in host and platform availability
- Is Visual Basic for Macros (VBA), Visual Studio Tools for Office (VSTO), COM Add-ins or Macros going away then?
No. Office.js is just another development platform for Office. There are no plans to deprecate any of the other programmability options for Office. Office.js was designed with the Cloud First, Mobile first vision at Microsoft and expands customizations across multiple platforms. It can be thought of as add-ins that you write once, run anywhere.
- I have an existing COM add-in. Do I need convert it to Office.js?
No. Unless of course you want your add-in to work across multiple platforms. However, it is important to consider what your add-in is doing. The current application programming interfaces (APIs) for Office.js are more limited. While they are increasing in capability every day, they are still not on parity with COM, VBA or VSTO.
- Can I convert my add-in in Visual Studio?
No. This is because the new Office.js developer platform is completely new. There are no conversion tools. If you want to make the move to Office.js, you will likely need to start from scratch. However, if you have properly separated your backend logic from application interfaces, you might be able to reuse some of your existing code as a Web Service.
- How do determine if my existing COM add-in can be rewritten in Office.js?
This is harder to answer. The short answer is you try to create it in the new platform and see how much you can get to function. Longer answer, there are a couple of approaches:
- You rewrite the entire thing in the new platform and where some things do not translate or work the same, you change the requirements to meet the new platform restrictions, such as changing the workflow, number of features or expected results.
- You write as much as you can in the new platform and keep building on it as the platform continues to take shape. Whatever you cannot accomplish in Office.js you write as a VSTO add-in.
- You provide a more limited Office.js version for the non-Windows based platforms you support but still use your COM or VSTO add-in on Windows.
- How do I develop an Office.js add-in?
There are a number of editors you can use. These are web based so technically you can use any platform you want. I suggest using Visual Studio where you have templates the provide you with predefined templates for Word, Excel, PowerPoint and Outlook Web Add-ins. Also, the Publishing process is much simplified in my opinion with the Visual Studio tools.
- How do Office Web Add-ins work?
Office Web Add-ins are web pages. You publish the web pages to a web server and the entire solution will load and run from there. As part of developing the add-in, you will create an XML file called a manifest. The Manifest in simplest terms will define the name of your add-in, a unique ID for your add-in, its version, a description, any ribbon commands and the URL to the website. In Office you can then add the manifest and this will register the add-in in your Office application and load the ribbon buttons defined. When the user clicks the ribbons the manifest will tell Office what URL to load and then the add-in will appear in a content pane or task pane.
- What if I have more questions?
Please ask in the comments section and I will work to continue to expand this FAQ.
13 thoughts on “Office.js: Jump on!”
I posted the question here. Can you please answer?
Building a local server defeats the purpose of OfficeJS. But also what you are trying to do is not really supported/supportable. There is no way to really mass deploy such a solution either. You would not be allowed to add it to the Microsoft Store. My suggestion is to write a VSTO or COM based add-in if you will limit your users to Windows and need to run everything locally.
[…] have been working on building out services for the back-end which can be consumed by both my OfficeJS Add-ins and any other host. In researching different options to deploy those services I started to delve […]
I have a angular word addin, its successfully running in production and everything is good, but issue is I have to run the test cases for my addin and angular code, I am able to do unit testing my angular code with karma/Jasmin, but Office.js is not recognized any more in my .spec file, i know office instance is recognized only when word or excel is running but how can I mock office.js and recognize the context.
You cannot mock office.js. You should completely separate your logic and interop concerns. Test your logic with calls to the functions with set inputs and expected results to test outcomes. Test the UI interaction/interop manually. Unfortunately, there is no other way around this with Office testing. It is an often asked feature. This is the only guidance for now: https://docs.microsoft.com/en-us/office/dev/add-ins/testing/test-debug-office-add-ins. To add to the suggestion box: https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/suggestions/34345651-add-in-developers-automated-testing-platform.
Hi could you please write a blog how i can debug office js in visual studio code using yo generator ,i have tried lot of time but not able to debug locally.Please help us on this………..
Currently, there is no way to debug OfficeJS from VS Code – yet. I am told that it is something that the Office product group and VS Code team are very interested in providing in a future update. I really do not have any more specifics other than to say, stay tuned.
Also, if you are needing to debug Office full-client there is something new in the Microsoft Store in Windows called Microsoft Edge DevTools Preview. Here is a link to install it: https://www.microsoft.com/store/productId/9MZBFRMZ0MNJ
If you are in the latest Monthly Channel of Office 365 the Office clients should be running Edge now and you will be able to connect to the Edge instance running in Office and debug your code that way. It is not the same as debugging from VS Code, but it will get you a step closer.
[…] Office online. However, one drawback has been that automation in Office online has been limited to Web Add-ins which are aimed solidly at professional developers. However, Visual Basic for Applications (VBA) macros are only supported in Windows and Mac clients. […]
[…] Office.js: FAQ Post […]
No. There is no way to call VBAA from OfficeJS or vice versa. That is a deliberate limitation because OfficeJS runs on every platform you can find Excel, Word or PowerPoint (such as iPad, iPhone, Web, Android, Mac and Windows), where as macros only run in Mac and Windows.