java.lang.Object
com.aspose.words.FootnoteType
public class FootnoteType
- extends java.lang.Object
Utility class containing constants.
Specifies whether this is a footnote or an endnote.
Both footnotes and endnotes are represented by objects by the FOOTNOTE
class. Use Footnote.FootnoteType to distinguish between footnotes
and endnotes.
Example:
Shows how to add a footnote to a paragraph in the document using DocumentBuilder.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
for (int i = 0; i <= 100; i++) {
builder.write("Some text " + i);
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote text " + i);
builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote text " + i, "242");
}
Example:
Shows how to add a footnote to a paragraph in the document and set its marker.
// Create a new document and append some text that we will reference with a footnote.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("Main body text.");
// Add a footnote and give it text, which will appear at the bottom of the page
Footnote footnote = builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote text.");
// This attribute means the footnote in the main text will automatically be assigned a number, "1" in this instance
// The next footnote will get "2"
Assert.assertTrue(footnote.isAuto());
// We can edit the footnote's text like this
// Make sure to move the builder back into the document body afterwards
builder.moveTo(footnote.getFirstParagraph());
builder.write(" More text added by a DocumentBuilder.");
builder.moveToDocumentEnd();
Assert.assertEquals(footnote.getParagraphs().get(0).toString(SaveFormat.TEXT).trim(), "Footnote text. More text added by a DocumentBuilder.");
builder.write(" More main body text.");
footnote = builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote text.");
// Substitute the reference number for our own custom mark by setting this variable, "IsAuto" will also be set to false
footnote.setReferenceMark("RefMark");
Assert.assertFalse(footnote.isAuto());
// This bookmark will get a number "3" even though there was no "2"
builder.write(" More main body text.");
footnote = builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote text.");
Assert.assertTrue(footnote.isAuto());
doc.save(getArtifactsDir() + "InlineStory.AddFootnote.docx");
- See Also:
- FOOTNOTE
Field Summary |
static final int | FOOTNOTE = 0 | |
The object is a footnote.
|
static final int | ENDNOTE = 1 | |
The object is an endnote.
|
FOOTNOTE = 0 | |
public static final int FOOTNOTE |
-
The object is a footnote.
ENDNOTE = 1 | |
public static final int ENDNOTE |
-
The object is an endnote.
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.