Content Office Add-ins
Content add-ins are surfaces that can be embedded directly into Excel or PowerPoint documents. Content add-ins give users access to interface controls that run code to modify documents or display data from a data source. Use content add-ins when you want to embed functionality directly into the document.
Figure 1. Typical layout for content add-ins
Best practices
- Include some navigational or commanding element such as the CommandBar or Pivot at the top of your add-in.
- Include a branding element such as the BrandBar at the bottom of your add-in (applies to Excel and PowerPoint add-ins only).
Variants
Content add-in sizes for Excel and PowerPoint in Office desktop and in a web browser are user specified.
Personality menu
Personality menus can obstruct navigational and commanding elements located near the top right of the add-in. The following are the current dimensions of the personality menu on Windows and Mac.
For Windows, the personality menu measures 12x32 pixels, as shown.
Figure 2. Personality menu on Windows
For Mac, the personality menu measures 26x26 pixels, but floats 8 pixels in from the right and 6 pixels from the top, which increases the occupied space to 34x32 pixels, as shown.
Figure 3. Personality menu on Mac
Implementation
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.
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.
- Add a "contentRuntimes" child array to the extension object in the "extensions" array.
- Remove the "runtimes" property if it is present. The "runtimes" array is for task pane or mail add-ins. These cannot be combined with a content add-in.
- Add an anonymous content runtime object in the "contentRuntimes" array.
- Set the "id" property of the object to a descriptive name.
- Set the "code.page" object to the full URL of the custom content that you want to embed in the document.
- 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.
- Optionally, set the "disableSnapshot" property to
true
to prevent Office from saving a snapshot of the content component with the document.
The following is an example of a "contentRuntimes" property.
"contentRuntimes": [
{
"id": "ContentRuntime",
"code": {
"page": "https://localhost:3000/content.html"
},
"requestedWidth": 100,
"requestedHeight": 100,
"disableSnapshot": true,
}
]
For a sample that implements a content add-in, see Excel Content Add-in Humongous Insurance on GitHub.
To create your own content add-in, see the Excel content add-in quick start and PowerPoint content add-in quick start.
Support considerations
- Check to see if your Office Add-in will work on a specific Office application or platform.
- Some content add-ins may require the user to "trust" the add-in to read and write to Excel or PowerPoint. You can declare what level of permissions you want your user to have in the add-in's manifest.
See also
Office Add-ins