March 27th, 2020

Office Add-in Development Community (PnP) – March 2020 update

The Office Add-ins platform team has new updates to share this month on Office Add-ins Patterns and Practices. PnP is a community effort, so if you are interested in contributing, see our good first issue list.

Use a shared library to migrate your Visual Studio Tools for Office Add-in to an Office web add-in

1. Diagram showing code shared in the cloud between a VSTO Add-in and an Office add-in

Visual Studio Tools for Office (VSTO) add-ins can only run in Office on Windows. By migrating your code to an Office web add-in, you can expand the reach of your add-in to mobile and online platforms. Migrating the code will involve rewriting it in the JavaScript language, and updating it to use the Office JavaScript APIs. However, you can reduce migration cost by creating a shared library and keeping some of your existing add-in code in its current language.

Manage ribbon and task pane UI, and run code on doc open

2. Screen shot of Office add-in ribbon with open and close task pane buttons, set doc load behavior buttons, and enabled and disabled buttons

This sample shows how to create contextual ribbon buttons that are enabled based on the state of your add-in. It also shows how to use the Office.js API to show or hide the task pane. This sample also demonstrates how to run code when the task pane is closed, such as on document open.

Share global data with a shared runtime

3. Screen shot of task pane with controls for storing or retrieving key/value pairs, and configuring global or local storage

This sample shows how to set up a basic project that uses the shared runtime. The shared runtime runs all parts of the Excel add-in (ribbon buttons, task pane, custom functions) in a single browser runtime. This makes it easy to share data through local storage, or through global variables.

Contributors from Microsoft

Here’s the list of Microsoft people who have been closely involved with the PnP work last month.

  • Jeremy Yoo @jeremy-msft
  • David Chesnut @davidchesnut

Want to contribute?

PnP is a community effort by developers like you. Check out our good first issue list as a great place to help with some samples. Feel free to contribute to existing samples or create new ones. Sharing is caring!

About Office Add-ins Patterns & Practices (PnP)

Office Add-ins PnP is a Microsoft-led, community driven effort that helps developers extend, build, and provision customizations on the Office platform the right way by providing guidance and help through official documentation and open source initiatives. The source is maintained in GitHub where anyone can participate. You can provide contributions to the samples, reusable components, and documentation. Office Add-ins PnP is owned and coordinated by Office engineering teams, but the work is done by the community for the community.

You can find code samples for Office Add-in development in the Office Add-ins PnP repo. Some samples are also documented in the Office Add-ins docs, such as Batching custom function calls for a remote service.

SharePoint PnP

Office Add-ins PnP and SharePoint PnP are both related community driven efforts. SharePoint PnP provides community solutions for developers building on SharePoint. For more information about SharePoint PnP, see https://docs.microsoft.com/en-us/sharepoint/dev/community/community

Additional resources

 

Learn more by joining the monthly Office Add-ins community call.