addFootnote
- addBackgroundImage
- addFooter
- addHeader
- addLineNumbering
- addPageBorders
- addProperties
- addSection
- createDocx
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importHeadersAndFooters
- importListStyle
- importStyles
- modifyPageLayout
- removeFooters
- removeHeaders
- setBackgroundColor
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- addBibliography
- addBookmark
- addBreak
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addText
- addTextBox
- addWordML
- embedHTML
- clearBlocks
- deleteTemplateBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- tickCheckbox
addFootnote

Inserts a footnote into the Word document.
Description
public void addFootnote(OptionsFootnote options) throws Exception
This method allows the insertion of a footnote into the Word document.
Parameters
options
Option | Type | Description |
---|---|---|
textDocument | String | Text that will appear in the Word document. |
textFootnote | WordFragment | WordFragment that will appear as the footnote in the Word document. |
footnoteMark | HashMap<String, String> |
|
referenceMark | HashMap<String, String> |
|
Code samples
Example #1
x
1
package examples.Core.addFootnote;
2
3
import java.util.ArrayList;
4
import java.util.HashMap;
5
6
import com.javadocx.CreateDocx;
7
import com.javadocx.WordFragment;
8
import com.javadocx.elements.*;
9
10
public class Sample1 {
11
public static void main(String[] args) throws Exception {
12
CreateDocx docx = new CreateDocx();
13
14
OptionsText textFootnote = new OptionsText();
15
textFootnote.setText("The footnote we want to insert.");
16
WordFragment textFootnoteFragment = new WordFragment(docx, "footnote");
17
textFootnoteFragment.addText(textFootnote);
18
19
OptionsImage imageOptions = new OptionsImage();
20
imageOptions.setImageAlign("center")
21
.setScaling(50)
22
.setTextWrap(0);
23
24
textFootnoteFragment.addImage("src/examples/files/img/image.png", imageOptions);
25
26
HashMap<String, String> footnoteMarkOptions = new HashMap<String, String>();
27
footnoteMarkOptions.put("customMark", "*");
28
29
OptionsFootnote footnoteOptions = new OptionsFootnote();
30
footnoteOptions.setTextDocument("footnote")
31
.setTextFootnote(textFootnoteFragment)
32
.setFootnoteMark(footnoteMarkOptions);
33
34
WordFragment footnoteFragment = new WordFragment(docx);
35
footnoteFragment.addFootnote(footnoteOptions);
36
37
OptionsText textOptionsA = new OptionsText();
38
textOptionsA.setText("Here comes the ");
39
WordFragment textFragmentA = new WordFragment(docx);
40
textFragmentA.addText(textOptionsA);
41
42
OptionsText textOptionsB = new OptionsText();
43
textOptionsB.setText(" and some other text.");
44
WordFragment textFragmentB = new WordFragment(docx);
45
textFragmentB.addText(textOptionsB);
46
47
ArrayList<WordFragment> text = new ArrayList<WordFragment>();
48
text.add(textFragmentA);
49
text.add(footnoteFragment);
50
text.add(textFragmentB);
51
52
docx.addText(text);
53
54
docx.addText("Some other text.");
55
56
docx.createDocx("example_addFootnote_1");
57
}
58
}
59