Class FootnoteNumberingRule

  • java.lang.Object
    • com.aspose.words.FootnoteNumberingRule
public class FootnoteNumberingRule 
extends java.lang.Object

Utility class containing constants. Determines when automatic footnote or endnote numbering restarts.


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.write("Text 3. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 3.");
builder.write("Text 4. ");
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote 4.");


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.");
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.getEndnoteOptions().setRestartRule(FootnoteNumberingRule.RESTART_SECTION); + "InlineStory.NumberingRule.docx");
See Also:
FootnoteOptions, EndnoteOptions

Field Summary
static final intCONTINUOUS = 0
Numbering continuous throughout the document.
static final intRESTART_SECTION = 1
Numbering restarts at each section.
static final intRESTART_PAGE = 2
Numbering restarts at each page. Valid for footnotes only.
static final intDEFAULT = 0

    • Field Detail

      • CONTINUOUS = 0

        public static final int CONTINUOUS
        Numbering continuous throughout the document.

        public static final int RESTART_SECTION
        Numbering restarts at each section.
      • RESTART_PAGE = 2

        public static final int RESTART_PAGE
        Numbering restarts at each page. Valid for footnotes only.
      • DEFAULT = 0

        public static final int DEFAULT
        Equals CONTINUOUS.