page_type | urlFragment | products | languages | extensions | description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
word-citation-management |
|
|
|
Shows how to manage citations in a Word document. |
This sample shows how to manage citations in Word with an add-in. The add-in uses the insertEndnote API to list inserted citations at the end of the document.
The user updates their Word document to include their citations and quotations. The user selects their bibliography file (.bib) through the add-in UI. The add-in lists the references found in the .bib file. The user selects the text in the document to cite then picks the option from the reference list displayed in the add-in UI. The inserted citations are listed at the end of the document.
The sample uses the @orcid/bibtexParseJs JavaScript library to parse the .bib file.
- Word on Windows
- Word on Mac
- Word on the web
- Office connected to a Microsoft 365 subscription (including Office on the web).
- Node.js version 16 or greater.
- npm version 8 or greater.
Solution | Authors |
---|---|
How to manage citations in a Word document | Microsoft |
Version | Date | Comments |
---|---|---|
1.0 | 11-28-2023 | Initial release |
-
Clone or download this repo.
-
Go to the Samples\word-citation-management folder via the command line.
-
Run
npm install
. -
Run
npm run build
. -
Start the local web server and sideload your add-in.
-
To test your add-in in Word, run the following command in the root directory of your project. This starts the local web server (if it's not already running) and opens Word with your add-in loaded.
- Windows:
npm start
- Mac:
npm run dev-server
- Windows:
-
To test your add-in in Word on the web, follow the instructions in Sideload a Yeoman-created add-in to Office on the web.
-
-
If the add-in task pane isn't already open in Word, go to the Home tab and choose the Show Taskpane button in the ribbon to open it.
-
In the "Bibliography sources" section of the add-in UI, select the Choose File button. Navigate to the local location of your .bib file then open the file.
For convenience, the resources folder of this project includes a sample.bib file.
-
In the document, select the text that you cited or quoted, or place the cursor.
-
In the list of references in the "References" section of the add-in UI, search for and select the reference you want to insert then select the Insert citation button. To unselect the selected radio button, choose the Clear selection button.
-
In the document, the reference mark appears at the end of the selected text and an endnote with the reference information is displayed at the end of the document.
The following are a few suggestions for how you could tailor this to your scenario.
- Include single sign-on (SSO) to support managing sessions and persisting settings for the user.
- Update the citation style used to display the references in the endnotes, or allow the user to choose the style.
- Use footnotes instead of endnotes, or allow the user to choose.
- Did you experience any problems with the sample? Create an issue and we'll help you out.
- We'd love to get your feedback about this sample. Go to our Office samples survey to give feedback and suggest improvements.
- For general questions about developing Office Add-ins, go to Microsoft Q&A using the office-js-dev tag.
Copyright (c) 2023 Microsoft Corporation. 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 [email protected] with any additional questions or comments.