OfficeDev/Word-Add-in-Load-and-write-Open-XML

Name: Word-Add-in-Load-and-write-Open-XML

Owner: Office Developer

Description: This sample app shows you how to add a variety of rich content types to a Word document using the setSelectedDataAsync method with ooxml coercion type. The app also gives you the ability to show the Office Open XML markup for each sample content type right on the page.

Created: 2015-08-13 18:04:00.0

Updated: 2018-04-26 16:25:22.0

Pushed: 2018-01-31 20:24:46.0

Homepage: null

Size: 1832

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Word-Add-in-Load-and-write-Open-XML

This sample add-in shows you how to add a variety of rich content types to a Word document using the setSelectedDataAsync method with ooxml coercion type. The app also gives you the ability to show the Office Open XML markup for each sample content type right on the page.

Description of the sample

The add-in initializes in a blank Word document. You choose an option to insert the content or its markup at the selection point in the active Word document and then click the object type you want from the following options:

Figure 1 shows how the task pane for the sample add-in appears when the solution starts.

Figure 1. The Loading and Writing OOXML task pane

Note

When you choose the option to see the markup for a selected type of content, what you're seeing is the Office Open XML edited to remove unnecessary markup, along with a few tips for additional guidance. You can also review any piece of markup used in the add-in (with formatting to make it easier to navigate) directly in the Visual Studio solution. For further help interpreting, editing, and simplifying your work with Office Open XML for Word add-ins, see Creating Better Add-ins for Word with Office Open XML.

Figures 2a - 2b show how the document surface and task pane appear after extracting Office Open XML from the selection.

Figure 2a. Document surface appearance after using the 'Get?' button to extract Office Open XML for selected content

Figure 2b. Task pane appearance after using the 'Get?' button to extract Office Open XML for selected content

Prerequisites

This sample requires:

Key components of the sample

The sample app contains:

All other files are automatically provided by the Visual Studio project template for Add-ins for Office, and they have not been modified in the development of this sample app.

Configure the sample

To configure the sample, open the LoadingAndWritingOOXML.sln file with Visual Studio. No other configuration is necessary.

Build the sample

To build the sample, choose the Ctrl+Shift+B keys.

Run and test the sample

To run the sample, choose the F5 key.

Troubleshooting

If the app fails to respond as described, try reloading it. (In the task pane, choose the down arrow, and then choose Reload.)

Change log

Related content

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.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.