
Notice that document.getStyles().addStyle(new XWPFStyle(style)) was used to add new styles to the document. Style.addNewLink().setVal("FootnoteText") Style.addNewName().setVal("Footnote Text Char") Rpr.addNewSzCs().setVal(new BigInteger("20")) Rpr.addNewSz().setVal(new BigInteger("20")) Style.addNewLink().setVal("FootnoteTextChar") Style.addNewName().setVal("footnote text") Style.addNewRPr().addNewVertAlign().setVal(STVerticalAlignRun.SUPERSCRIPT) ĭocument.getStyles().addStyle(new XWPFStyle(style)) Style.addNewUiPriority().setVal(new BigInteger("99")) Style.addNewBasedOn().setVal("DefaultParagraphFont") Style.addNewName().setVal("footnote reference") Below is the Open XML for all three of them: Īnd adding this in java: CTStyle style = () In order to give the footnote it's own style with a superscript three styles need to be added.
#How to add footnote in word document code
This can easily be done in java using the code below: ctr = document.getParagraphArray(0).getCTP().addNewR() The Open XML for a reference looks like the following:

This is in the main body of the document. Now to add a reference to the document's paragraphs - I don't believe that a footnote will even be visible at the bottom of the page without a reference. You can either open your document within word from the 'File' tab or you can find your file in your file browser, right-click on it, then select 'Open With' and 'Word.' 2 Go to your footnote reference. Once the tags have been added to the CTFtnEdn instance it needs to be added to the WMPFDocument using document.addFootnote(). 2- Go to Reference tab and select Insert footnote. 1- Place the cursor at the location which you want to add a footnote.
#How to add footnote in word document how to
Now to add the contents of the footnote I referenced the contents found inside a Footnote made using word: Īnd here is an example of making that using java: CTFtnEdn ctfInstance = () Ĭtp.addNewPPr().addNewPStyle().setVal("FootnoteText") Ĭtr.addNewRPr().addNewRStyle().setVal("FootnoteReference") ĬtStringValue("This is the text in the footnote") ĬtSpace() How to Create a Footnote for Your Word Document.
After reviewing the Open XML of a document where the footnotes were added using word, I found that not only was a footnote needed, but also a reference inside the paragraph, and optionally but highly recommended three styles.Īdding a footnote to the document requires a CTFtnEdn instance, which can be achieved by using (). However, it’s up to you to ensure the information they provide is reliable and accurate.Īlways make sure to properly cite your sources to avoid plagiarism.I'm not sure if this is the best way of going about adding footnotes to a word document, but it does work. Primary sources are often considered the most credible in terms of providing evidence for your argument, as they give you direct evidence of what you are researching. If you use one of these in your research, it is probably a primary source. Some types of source are nearly always primary: works of art and literature, raw statistical data, official documents and records, and personal communications (e.g.
