Name: Word-Add-in-JavaScript-AddPopulateBindings
Owner: Office Developer
Description: Shows how to add and bind to a named rich text content control in Word, and how to insert content at the bound location.
Created: 2015-08-19 02:35:17.0
Updated: 2016-11-28 12:04:08.0
Pushed: 2018-01-31 20:25:22.0
Homepage: null
Size: 1127
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Table of contents
This sample shows how to add and bind to a named rich text content control in Word, and how to insert content at the bound location.
This sample requires the following:
The sample solution contains the following key files:
PopulateBindings project
PopulateBindingsWeb project
The sample demonstrates how to:
The add-in initializes in a blank Word document. The following screenshot shows the initial view of the task pane add-in.
Bindings can greatly expand the options for Word add-ins. Use bindings to add content at a specified location in the document, not just at the user's active selection point. In Word add-ins, rich text controls are the only type of content control you can bind to. Note that the control placeholder content must include at least one complete paragraph in order to enable you to populate the binding with multi-paragraph content. The file ContentControl.xml in the Snippets_BindAndPopulate folder in this solution shows how to structure your content control for successful binding. To learn more about working with bindings in Word add-ins, see Creating Better Word Add-ins with Office Open XML.
In Visual Studio, press F5 to build and deploy the solution. You can optionally add content in the document.
In the Home ribbon, click Open in the Populate Bindings group.
In the add-in, click Add and Bind Control. The placeholder text for the control appears in the document.
Click one of the Insert buttons to populate the binding initially, and the other to replace the contents of the binding with new content.
Copyright (c) 2015 Microsoft. All rights reserved.
This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.