Name: Word-Add-in-JavaScript-ChangeContentWithXML
Owner: Office Developer
Description: The sample Word Add-in shows how to use JavaScript to extract Open XML from a potentially complex document. The sample also shows how to insert a fragment of Open XML into a document.
Created: 2015-08-12 23:19:58.0
Updated: 2017-01-09 20:57:11.0
Pushed: 2018-01-31 20:24:59.0
Size: 1252
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Table of contents
The sample Word Add-in shows how to use JavaScript to extract Open XML from a potentially complex document. The sample also shows how to insert a selected fragment of Open XML into a document.
The sample comes with a test document ComplexDoc.docx, which is set as the StartAction property of the task pane add-in. The document contains a mixture of images with various layout options and text. Make sure the document loads when you start debugging, and if not, check the StartAction property of the project.
Note The sample uses Open XML instead of HTML or plain text, because only Open XML is capable of handling the Base64 data that represents the images in the document. Also, Open XML is potentially more powerful at describing text flows with images.
This sample requires:
The sample solution contains the following files:
The sample add-in contains the ChangeContentWithXML project, which contains:
It also contains the ChangeContentWithXMLWeb project, which includes:
Note It is recommended that you select all the content between the two instructions as shown the first time you run the sample, so that you can see the full power of Open XML. You can experiment with selecting smaller sections after that.
If the add-in starts with a blank document instead of the test document, ensure the Start Document property of the project is set to ComplexDoc.docx and not just to [New Word document].
To do this, select the ChangeContentWithXML project in the Solution Explorer and view the properties in the Properties window. Under App you will see Start Action and Start Document listed. The values for these should be:
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.