Learn how you can create an add-in that searches, highlights and redacts text.
Table of Contents
- Change History
- Important note
- Configure the project
- Run the project
- Questions and comments
- Additional resources
July 25, 2016:
- Initial sample version.
This sample redacts text by replacing each letter with an asterisk. The layout is not preserve as such. No measurement and calculation is done to determine font, size, or formatting of each letter.
- Word 2016 for Windows, build 16.0.6912.1000 or later.
- Node and npm
- Git Bash - You should use a later build as earlier builds can show an error when generating the certificates.
Configure the project
Run the following commands from your Bash shell at the root of this project:
- Clone this repo to your local machine.
npm installto install all of the dependencies in package.json.
bash gen-cert.shto create the certificates needed to run this sample.
- Then in the repo on your local machine, double-click ca.crt, and select Install Certificate.
- Select Local Machine and select Next to continue.
- Select Place all certificates in the following store and then select Browse.
- Select Trusted Root Certification Authorities and then select OK.
- Select Next and then Finish and now your certificate authority cert has been added to your certificate store.
npm startto start the node web server service.
Now you need to let Microsoft Word know where to find the add-in.
- Launch Word and open a document.
- Choose the File tab, and then choose Options.
- Choose Trust Center, and then choose the Trust Center Settings button.
- Choose Trusted Add-ins Catalogs.
- In the Catalog Url field, enter the network path to the folder share that contains word-add-in-js-redact-manifest.xml, and then choose Add Catalog.
- Select the Show in Menu check box, and then choose OK.
- A message is displayed to inform you that your settings will be applied the next time you start Microsoft Office. Close and restart Word.
Run the project
- Open a Word document.
- On the Insert tab in Word 2016, choose My Add-ins.
- Select the SHARED FOLDER tab.
- Choose Word Redact add-in, and then select OK.
- If add-in commands are supported by your version of Word, the UI will inform you that the add-in was loaded.
On the Ribbon:
- Select Review tab and choose Show Redaction Task Pane to launch the task pane.
Note: The add-in will load in a task pane if add-in commands are not supported by your version of Word.
Task pane UI
On the task pane, you can:
- Search and highlight text in a document by entering word in the text box and selecting the Search and Highlight button.
NOTE: Search is case-sensitive. To undo an action, press Ctrl+Z on your keyboard.
- Redact text in a document by entering word in the text box and selecting Redact button.
NOTE: Redact is case-insensitive.
- Redact selected text in a document by choosing Redact selected text button.
NOTE: Redact is case-insensitive.
This sample shows how to create add-in commands in the ribbon. The add-in command declarations are located in word-add-in-js-redact-manifest.xml.
Questions and comments
We'd love to get your feedback about the Word Redact sample. You can send your feedback to us in the Issues section of this repository.
Questions about Microsoft Office 365 development in general should be posted to Stack Overflow. Make sure that your questions are tagged with [office-js] and [API].
Copyright (c) 2016 Microsoft Corporation. All rights reserved.