EndnoteOptions
Inheritance: java.lang.Object
public class EndnoteOptions
Represents the endnote numbering options for a document or section.
To learn more, visit the Working with Footnote and Endnote documentation article.
Examples:
Shows how to select a different place where the document collects and displays its endnotes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// An endnote is a way to attach a reference or a side comment to text
// that does not interfere with the main body text's flow.
// Inserting an endnote adds a small superscript reference symbol
// at the main body text where we insert the endnote.
// Each endnote also creates an entry at the end of the document, consisting of a symbol
// that matches the reference symbol in the main body text.
// The reference text that we pass to the document builder's "InsertEndnote" method.
builder.write("Hello world!");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote contents.");
builder.insertBreak(BreakType.SECTION_BREAK_NEW_PAGE);
builder.write("This is the second section.");
// We can use the "Position" property to determine where the document will place all its endnotes.
// If we set the value of the "Position" property to "EndnotePosition.EndOfDocument",
// every footnote will show up in a collection at the end of the document. This is the default value.
// If we set the value of the "Position" property to "EndnotePosition.EndOfSection",
// every footnote will show up in a collection at the end of the section whose text contains the endnote's reference mark.
doc.getEndnoteOptions().setPosition(endnotePosition);
doc.save(getArtifactsDir() + "InlineStory.PositionEndnote.docx");
Shows how to set a number at which the document begins the footnote/endnote count.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Footnotes and endnotes are a way to attach a reference or a side comment to text
// that does not interfere with the main body text's flow.
// Inserting a footnote/endnote adds a small superscript reference symbol
// at the main body text where we insert the footnote/endnote.
// Each footnote/endnote also creates an entry, which consists of a symbol
// that matches the reference symbol in the main body text.
// The reference text that we pass to the document builder's "InsertEndnote" method.
// Footnote entries, by default, show up at the bottom of each page that contains
// their reference symbols, and endnotes show up at the end of the document.
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 2.");
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 3.");
builder.insertParagraph();
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 2.");
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 3.");
// By default, the reference symbol for each footnote and endnote is its index
// among all the document's footnotes/endnotes. Each document maintains separate counts
// for footnotes and for endnotes, which both begin at 1.
Assert.assertEquals(1, doc.getFootnoteOptions().getStartNumber());
Assert.assertEquals(1, doc.getEndnoteOptions().getStartNumber());
// We can use the "StartNumber" property to get the document to
// begin a footnote or endnote count at a different number.
doc.getEndnoteOptions().setNumberStyle(NumberStyle.ARABIC);
doc.getEndnoteOptions().setStartNumber(50);
doc.save(getArtifactsDir() + "InlineStory.StartNumber.docx");
Shows how to change the number style of footnote/endnote reference marks.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Footnotes and endnotes are a way to attach a reference or a side comment to text
// that does not interfere with the main body text's flow.
// Inserting a footnote/endnote adds a small superscript reference symbol
// at the main body text where we insert the footnote/endnote.
// Each footnote/endnote also creates an entry, which consists of a symbol that matches the reference
// symbol in the main body text. The reference text that we pass to the document builder's "InsertEndnote" method.
// Footnote entries, by default, show up at the bottom of each page that contains
// their reference symbols, and endnotes show up at the end of the document.
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 2.");
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 3.", "Custom footnote reference mark");
builder.insertParagraph();
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 2.");
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 3.", "Custom endnote reference mark");
// By default, the reference symbol for each footnote and endnote is its index
// among all the document's footnotes/endnotes. Each document maintains separate counts
// for footnotes and for endnotes. By default, footnotes display their numbers using Arabic numerals,
// and endnotes display their numbers in lowercase Roman numerals.
Assert.assertEquals(NumberStyle.ARABIC, doc.getFootnoteOptions().getNumberStyle());
Assert.assertEquals(NumberStyle.LOWERCASE_ROMAN, doc.getEndnoteOptions().getNumberStyle());
// We can use the "NumberStyle" property to apply custom numbering styles to footnotes and endnotes.
// This will not affect footnotes/endnotes with custom reference marks.
doc.getFootnoteOptions().setNumberStyle(NumberStyle.UPPERCASE_ROMAN);
doc.getEndnoteOptions().setNumberStyle(NumberStyle.UPPERCASE_LETTER);
doc.save(getArtifactsDir() + "InlineStory.RefMarkNumberStyle.docx");
Shows how to restart footnote/endnote numbering at certain places in the document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Footnotes and endnotes are a way to attach a reference or a side comment to text
// that does not interfere with the main body text's flow.
// Inserting a footnote/endnote adds a small superscript reference symbol
// at the main body text where we insert the footnote/endnote.
// Each footnote/endnote also creates an entry, which consists of a symbol that matches the reference
// symbol in the main body text. The reference text that we pass to the document builder's "InsertEndnote" method.
// Footnote entries, by default, show up at the bottom of each page that contains
// their reference symbols, and endnotes show up at the end of the document.
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 2.");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 3.");
builder.write("Text 4. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 4.");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 2.");
builder.insertBreak(BreakType.SECTION_BREAK_NEW_PAGE);
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 3.");
builder.write("Text 4. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 4.");
// By default, the reference symbol for each footnote and endnote is its index
// among all the document's footnotes/endnotes. Each document maintains separate counts
// for footnotes and endnotes and does not restart these counts at any point.
Assert.assertEquals(doc.getFootnoteOptions().getRestartRule(), FootnoteNumberingRule.DEFAULT);
Assert.assertEquals(FootnoteNumberingRule.DEFAULT, FootnoteNumberingRule.CONTINUOUS);
// We can use the "RestartRule" property to get the document to restart
// the footnote/endnote counts at a new page or section.
doc.getFootnoteOptions().setRestartRule(FootnoteNumberingRule.RESTART_PAGE);
doc.getEndnoteOptions().setRestartRule(FootnoteNumberingRule.RESTART_SECTION);
doc.save(getArtifactsDir() + "InlineStory.NumberingRule.docx");
Methods
Method | Description |
---|---|
getLocation() | |
getNumberStyle() | Specifies the number format for automatically numbered endnotes. |
getPosition() | Specifies the endnotes position. |
getRestartRule() | Determines when automatic numbering restarts. |
getStartNumber() | Specifies the starting number or character for the first automatically numbered endnotes. |
setLocation(int value) | |
setNumberStyle(int value) | Specifies the number format for automatically numbered endnotes. |
setPosition(int value) | Specifies the endnotes position. |
setRestartRule(int value) | Determines when automatic numbering restarts. |
setStartNumber(int value) | Specifies the starting number or character for the first automatically numbered endnotes. |
getLocation()
public int getLocation()
Returns: int
getNumberStyle()
public int getNumberStyle()
Specifies the number format for automatically numbered endnotes.
Remarks:
Not all number styles are applicable for this property. For the list of applicable number styles see the Insert Footnote or Endnote dialog box in Microsoft Word. If you select a number style that is not applicable, Microsoft Word will revert to a default value.
Examples:
Shows how to change the number style of footnote/endnote reference marks.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Footnotes and endnotes are a way to attach a reference or a side comment to text
// that does not interfere with the main body text's flow.
// Inserting a footnote/endnote adds a small superscript reference symbol
// at the main body text where we insert the footnote/endnote.
// Each footnote/endnote also creates an entry, which consists of a symbol that matches the reference
// symbol in the main body text. The reference text that we pass to the document builder's "InsertEndnote" method.
// Footnote entries, by default, show up at the bottom of each page that contains
// their reference symbols, and endnotes show up at the end of the document.
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 2.");
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 3.", "Custom footnote reference mark");
builder.insertParagraph();
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 2.");
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 3.", "Custom endnote reference mark");
// By default, the reference symbol for each footnote and endnote is its index
// among all the document's footnotes/endnotes. Each document maintains separate counts
// for footnotes and for endnotes. By default, footnotes display their numbers using Arabic numerals,
// and endnotes display their numbers in lowercase Roman numerals.
Assert.assertEquals(NumberStyle.ARABIC, doc.getFootnoteOptions().getNumberStyle());
Assert.assertEquals(NumberStyle.LOWERCASE_ROMAN, doc.getEndnoteOptions().getNumberStyle());
// We can use the "NumberStyle" property to apply custom numbering styles to footnotes and endnotes.
// This will not affect footnotes/endnotes with custom reference marks.
doc.getFootnoteOptions().setNumberStyle(NumberStyle.UPPERCASE_ROMAN);
doc.getEndnoteOptions().setNumberStyle(NumberStyle.UPPERCASE_LETTER);
doc.save(getArtifactsDir() + "InlineStory.RefMarkNumberStyle.docx");
Returns: int - The corresponding int value. The returned value is one of NumberStyle constants.
getPosition()
public int getPosition()
Specifies the endnotes position.
Examples:
Shows how to select a different place where the document collects and displays its endnotes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// An endnote is a way to attach a reference or a side comment to text
// that does not interfere with the main body text's flow.
// Inserting an endnote adds a small superscript reference symbol
// at the main body text where we insert the endnote.
// Each endnote also creates an entry at the end of the document, consisting of a symbol
// that matches the reference symbol in the main body text.
// The reference text that we pass to the document builder's "InsertEndnote" method.
builder.write("Hello world!");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote contents.");
builder.insertBreak(BreakType.SECTION_BREAK_NEW_PAGE);
builder.write("This is the second section.");
// We can use the "Position" property to determine where the document will place all its endnotes.
// If we set the value of the "Position" property to "EndnotePosition.EndOfDocument",
// every footnote will show up in a collection at the end of the document. This is the default value.
// If we set the value of the "Position" property to "EndnotePosition.EndOfSection",
// every footnote will show up in a collection at the end of the section whose text contains the endnote's reference mark.
doc.getEndnoteOptions().setPosition(endnotePosition);
doc.save(getArtifactsDir() + "InlineStory.PositionEndnote.docx");
Returns: int - The corresponding int value. The returned value is one of EndnotePosition constants.
getRestartRule()
public int getRestartRule()
Determines when automatic numbering restarts.
Remarks:
Not all values are applicable to endnotes. To ascertain which values are applicable see FootnoteNumberingRule.
Examples:
Shows how to restart footnote/endnote numbering at certain places in the document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Footnotes and endnotes are a way to attach a reference or a side comment to text
// that does not interfere with the main body text's flow.
// Inserting a footnote/endnote adds a small superscript reference symbol
// at the main body text where we insert the footnote/endnote.
// Each footnote/endnote also creates an entry, which consists of a symbol that matches the reference
// symbol in the main body text. The reference text that we pass to the document builder's "InsertEndnote" method.
// Footnote entries, by default, show up at the bottom of each page that contains
// their reference symbols, and endnotes show up at the end of the document.
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 2.");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 3.");
builder.write("Text 4. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 4.");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 2.");
builder.insertBreak(BreakType.SECTION_BREAK_NEW_PAGE);
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 3.");
builder.write("Text 4. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 4.");
// By default, the reference symbol for each footnote and endnote is its index
// among all the document's footnotes/endnotes. Each document maintains separate counts
// for footnotes and endnotes and does not restart these counts at any point.
Assert.assertEquals(doc.getFootnoteOptions().getRestartRule(), FootnoteNumberingRule.DEFAULT);
Assert.assertEquals(FootnoteNumberingRule.DEFAULT, FootnoteNumberingRule.CONTINUOUS);
// We can use the "RestartRule" property to get the document to restart
// the footnote/endnote counts at a new page or section.
doc.getFootnoteOptions().setRestartRule(FootnoteNumberingRule.RESTART_PAGE);
doc.getEndnoteOptions().setRestartRule(FootnoteNumberingRule.RESTART_SECTION);
doc.save(getArtifactsDir() + "InlineStory.NumberingRule.docx");
Returns: int - The corresponding int value. The returned value is one of FootnoteNumberingRule constants.
getStartNumber()
public int getStartNumber()
Specifies the starting number or character for the first automatically numbered endnotes.
Remarks:
This property has effect only when getRestartRule() / setRestartRule(int) is set to FootnoteNumberingRule.CONTINUOUS.
Examples:
Shows how to set a number at which the document begins the footnote/endnote count.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Footnotes and endnotes are a way to attach a reference or a side comment to text
// that does not interfere with the main body text's flow.
// Inserting a footnote/endnote adds a small superscript reference symbol
// at the main body text where we insert the footnote/endnote.
// Each footnote/endnote also creates an entry, which consists of a symbol
// that matches the reference symbol in the main body text.
// The reference text that we pass to the document builder's "InsertEndnote" method.
// Footnote entries, by default, show up at the bottom of each page that contains
// their reference symbols, and endnotes show up at the end of the document.
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 2.");
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 3.");
builder.insertParagraph();
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 2.");
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 3.");
// By default, the reference symbol for each footnote and endnote is its index
// among all the document's footnotes/endnotes. Each document maintains separate counts
// for footnotes and for endnotes, which both begin at 1.
Assert.assertEquals(1, doc.getFootnoteOptions().getStartNumber());
Assert.assertEquals(1, doc.getEndnoteOptions().getStartNumber());
// We can use the "StartNumber" property to get the document to
// begin a footnote or endnote count at a different number.
doc.getEndnoteOptions().setNumberStyle(NumberStyle.ARABIC);
doc.getEndnoteOptions().setStartNumber(50);
doc.save(getArtifactsDir() + "InlineStory.StartNumber.docx");
Returns: int - The corresponding int value.
setLocation(int value)
public void setLocation(int value)
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setNumberStyle(int value)
public void setNumberStyle(int value)
Specifies the number format for automatically numbered endnotes.
Remarks:
Not all number styles are applicable for this property. For the list of applicable number styles see the Insert Footnote or Endnote dialog box in Microsoft Word. If you select a number style that is not applicable, Microsoft Word will revert to a default value.
Examples:
Shows how to change the number style of footnote/endnote reference marks.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Footnotes and endnotes are a way to attach a reference or a side comment to text
// that does not interfere with the main body text's flow.
// Inserting a footnote/endnote adds a small superscript reference symbol
// at the main body text where we insert the footnote/endnote.
// Each footnote/endnote also creates an entry, which consists of a symbol that matches the reference
// symbol in the main body text. The reference text that we pass to the document builder's "InsertEndnote" method.
// Footnote entries, by default, show up at the bottom of each page that contains
// their reference symbols, and endnotes show up at the end of the document.
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 2.");
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 3.", "Custom footnote reference mark");
builder.insertParagraph();
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 2.");
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 3.", "Custom endnote reference mark");
// By default, the reference symbol for each footnote and endnote is its index
// among all the document's footnotes/endnotes. Each document maintains separate counts
// for footnotes and for endnotes. By default, footnotes display their numbers using Arabic numerals,
// and endnotes display their numbers in lowercase Roman numerals.
Assert.assertEquals(NumberStyle.ARABIC, doc.getFootnoteOptions().getNumberStyle());
Assert.assertEquals(NumberStyle.LOWERCASE_ROMAN, doc.getEndnoteOptions().getNumberStyle());
// We can use the "NumberStyle" property to apply custom numbering styles to footnotes and endnotes.
// This will not affect footnotes/endnotes with custom reference marks.
doc.getFootnoteOptions().setNumberStyle(NumberStyle.UPPERCASE_ROMAN);
doc.getEndnoteOptions().setNumberStyle(NumberStyle.UPPERCASE_LETTER);
doc.save(getArtifactsDir() + "InlineStory.RefMarkNumberStyle.docx");
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | The corresponding int value. The value must be one of NumberStyle constants. |
setPosition(int value)
public void setPosition(int value)
Specifies the endnotes position.
Examples:
Shows how to select a different place where the document collects and displays its endnotes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// An endnote is a way to attach a reference or a side comment to text
// that does not interfere with the main body text's flow.
// Inserting an endnote adds a small superscript reference symbol
// at the main body text where we insert the endnote.
// Each endnote also creates an entry at the end of the document, consisting of a symbol
// that matches the reference symbol in the main body text.
// The reference text that we pass to the document builder's "InsertEndnote" method.
builder.write("Hello world!");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote contents.");
builder.insertBreak(BreakType.SECTION_BREAK_NEW_PAGE);
builder.write("This is the second section.");
// We can use the "Position" property to determine where the document will place all its endnotes.
// If we set the value of the "Position" property to "EndnotePosition.EndOfDocument",
// every footnote will show up in a collection at the end of the document. This is the default value.
// If we set the value of the "Position" property to "EndnotePosition.EndOfSection",
// every footnote will show up in a collection at the end of the section whose text contains the endnote's reference mark.
doc.getEndnoteOptions().setPosition(endnotePosition);
doc.save(getArtifactsDir() + "InlineStory.PositionEndnote.docx");
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | The corresponding int value. The value must be one of EndnotePosition constants. |
setRestartRule(int value)
public void setRestartRule(int value)
Determines when automatic numbering restarts.
Remarks:
Not all values are applicable to endnotes. To ascertain which values are applicable see FootnoteNumberingRule.
Examples:
Shows how to restart footnote/endnote numbering at certain places in the document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Footnotes and endnotes are a way to attach a reference or a side comment to text
// that does not interfere with the main body text's flow.
// Inserting a footnote/endnote adds a small superscript reference symbol
// at the main body text where we insert the footnote/endnote.
// Each footnote/endnote also creates an entry, which consists of a symbol that matches the reference
// symbol in the main body text. The reference text that we pass to the document builder's "InsertEndnote" method.
// Footnote entries, by default, show up at the bottom of each page that contains
// their reference symbols, and endnotes show up at the end of the document.
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 2.");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 3.");
builder.write("Text 4. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 4.");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 2.");
builder.insertBreak(BreakType.SECTION_BREAK_NEW_PAGE);
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 3.");
builder.write("Text 4. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 4.");
// By default, the reference symbol for each footnote and endnote is its index
// among all the document's footnotes/endnotes. Each document maintains separate counts
// for footnotes and endnotes and does not restart these counts at any point.
Assert.assertEquals(doc.getFootnoteOptions().getRestartRule(), FootnoteNumberingRule.DEFAULT);
Assert.assertEquals(FootnoteNumberingRule.DEFAULT, FootnoteNumberingRule.CONTINUOUS);
// We can use the "RestartRule" property to get the document to restart
// the footnote/endnote counts at a new page or section.
doc.getFootnoteOptions().setRestartRule(FootnoteNumberingRule.RESTART_PAGE);
doc.getEndnoteOptions().setRestartRule(FootnoteNumberingRule.RESTART_SECTION);
doc.save(getArtifactsDir() + "InlineStory.NumberingRule.docx");
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | The corresponding int value. The value must be one of FootnoteNumberingRule constants. |
setStartNumber(int value)
public void setStartNumber(int value)
Specifies the starting number or character for the first automatically numbered endnotes.
Remarks:
This property has effect only when getRestartRule() / setRestartRule(int) is set to FootnoteNumberingRule.CONTINUOUS.
Examples:
Shows how to set a number at which the document begins the footnote/endnote count.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Footnotes and endnotes are a way to attach a reference or a side comment to text
// that does not interfere with the main body text's flow.
// Inserting a footnote/endnote adds a small superscript reference symbol
// at the main body text where we insert the footnote/endnote.
// Each footnote/endnote also creates an entry, which consists of a symbol
// that matches the reference symbol in the main body text.
// The reference text that we pass to the document builder's "InsertEndnote" method.
// Footnote entries, by default, show up at the bottom of each page that contains
// their reference symbols, and endnotes show up at the end of the document.
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 2.");
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 3.");
builder.insertParagraph();
builder.write("Text 1. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 1.");
builder.write("Text 2. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 2.");
builder.write("Text 3. ");
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote 3.");
// By default, the reference symbol for each footnote and endnote is its index
// among all the document's footnotes/endnotes. Each document maintains separate counts
// for footnotes and for endnotes, which both begin at 1.
Assert.assertEquals(1, doc.getFootnoteOptions().getStartNumber());
Assert.assertEquals(1, doc.getEndnoteOptions().getStartNumber());
// We can use the "StartNumber" property to get the document to
// begin a footnote or endnote count at a different number.
doc.getEndnoteOptions().setNumberStyle(NumberStyle.ARABIC);
doc.getEndnoteOptions().setStartNumber(50);
doc.save(getArtifactsDir() + "InlineStory.StartNumber.docx");
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | The corresponding int value. |