Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Excel PowerPoint] (content addins) add support for unified manifest #4668

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
44 changes: 42 additions & 2 deletions docs/design/content-add-ins.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Content Office Add-ins
description: Content add-ins are surfaces that can be embedded directly into Excel or PowerPoint documents that give users access to interface controls that run code to modify documents or display data from a data source.
ms.date: 06/27/2024
ms.date: 07/17/2024
ms.topic: overview
ms.localizationpriority: medium
---
Expand Down Expand Up @@ -41,11 +41,51 @@ For Mac, the personality menu measures 26x26 pixels, but floats 8 pixels in from

## Implementation

There are minor differences in the manifests between content add-ins and add-ins that use task panes.
There are minor differences in the manifests between content add-ins and add-ins that use task panes. Open the tab for the type of manifest you're using.

# [Unified manifest for Microsoft 365](#tab/jsonmanifest)

> [!NOTE]
> The unified manifest is available in Excel, PowerPoint, and Word as a developer preview. For Outlook, it's generally available and can be used in production add-ins.

Configure the manifest with the following steps.

1. Add a "contentRuntimes" child array to the extension object in the "extensions" array.
1. Add an anonymous content runtime object in the "contentRuntimes" array.
1. Set the "id" property of the object to a descriptive name.
1. Set the "code.page" object to the full URL of the page that contains the content.
1. Optionally, set the "requestedWidth" and "requestedHeight" properties to a size between 32 and 1000 pixels. If these properties aren't used, the Office application determines the size.
1. Optionally, set the "disableSnapshot" property to `true` to prevent Office from saving a snapshot of the content component with the document.
1. Optionally, add a "requirements.scopes" property to restrict the installability of the content component to only Excel or only PowerPoint. The allowed values are "workbook" and "presentation". (Listing both means the content component is available in both, which is the same as having no "requirements" property at all.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like requirements property is on this object. If so, will you be updating the requirements property article in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like requirements property is on this object. If so, will you be updating the requirements property article in this PR?

Good catch. I should do that in the same PR.


The following is an example of a "contentRuntimes" property.

```json
"contentRuntimes": [
{
"id": "ContentRuntime",
"code": {
"page": "https://localhost:3000/content.html"
},
"requestedWidth": 100,
"requestedHeight": 100,
"disableSnapshot": true,
"requirements": {
"scopes": [
"workbook"
]
},
}
]
```

# [XML Manifest](#tab/xmlmanifest)

- For the **\<[OfficeApp](/javascript/api/manifest/officeapp)\>** element, set the `xsi:type` attribute to `"ContentApp"`.
- In the **\<[DefaultSettings](/javascript/api/manifest/defaultsettings)\>** element, add the **\<[RequestedHeight](/javascript/api/manifest/requestedheight)\>** and **\<[RequestedWidth](/javascript/api/manifest/requestedwidth)\>** elements.

---

For a sample that implements a content add-in, see [Excel Content Add-in Humongous Insurance](https://github.com/OfficeDev/Excel-Content-Add-in-Humongous-Insurance) on GitHub.

To create your own content add-in, see the [Excel content add-in quick start](../quickstarts/excel-quickstart-content.md) and [PowerPoint content add-in quick start](../quickstarts/powerpoint-quickstart-content.md).
Expand Down
29 changes: 28 additions & 1 deletion docs/develop/requirements-property-unified-manifest.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Specify Office Add-in requirements in the unified manifest for Microsoft 365
description: Learn how to use requirements to configure on which host and platforms an add-in can be installed and which features are available.
ms.date: 07/03/2024
ms.date: 07/17/2024
ms.topic: how-to
ms.localizationpriority: medium
---
Expand Down Expand Up @@ -134,6 +134,33 @@ For example, suppose an Outlook add-in is configured to autolaunch in response t
]
```

### extensions.contentRuntimes.requirements

The "extensions.contentRuntimes" property configures how a custom page in your add-in is embedded in the surface of an Office document. The "requirements" subproperty can be used to embed the page only when certain requirements are met.

For example, suppose you want to embed the page only in Excel, not PowerPoint. You could do that with markup similar to the following:


```json
"extensions": [
...
{
...
"contentRuntimes": [
{
// Insert details of the contentRuntime configuration here.

"requirements": {
"scopes": [
"workbook"
]
},
}
]
}
]
```

### extensions.contextMenus.requirements

The "extensions.contextMenus" property configures the add-in's context menus. A context menu is a shortcut menu that appears when you right-click (or select and hold) in the Office UI. The "requirements" subproperty can be used to allow context menus only when certain requirements are met.
Expand Down