public class FieldAutoNumOut extends Field
To learn more, visit the Working with Fields documentation article.
Remarks:
Inserts an automatic number in outline format.
Examples:
Shows how to number paragraphs using AUTONUMOUT fields.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// AUTONUMOUT fields display a number that increments at each AUTONUMOUT field.
// Unlike AUTONUM fields, AUTONUMOUT fields use the outline numbering scheme,
// which we can define in Microsoft Word via Format -> Bullets & Numbering -> "Outline Numbered".
// This allows us to automatically number items like a numbered list.
// LISTNUM fields are a newer alternative to AUTONUMOUT fields.
// This field will display "1.".
builder.insertField(FieldType.FIELD_AUTO_NUM_OUTLINE, true);
builder.writeln("\tParagraph 1.");
// This field will display "2.".
builder.insertField(FieldType.FIELD_AUTO_NUM_OUTLINE, true);
builder.writeln("\tParagraph 2.");
for (Field field : doc.getRange().getFields()) {
if (field.getType() == FieldType.FIELD_AUTO_NUM_OUTLINE) {
Assert.assertEquals(field.getFieldCode(), " AUTONUMOUT ");
}
}
doc.save(getArtifactsDir() + "Field.AUTONUMOUT.docx");
getDisplayResult, getEnd, getFieldCode, getFieldCode, getFormat, getLocaleId, getResult, getSeparator, getStart, getType, isDirty, isDirty, isLocked, isLocked, needStoreOldResultNodes, remove, setLocaleId, setResult, unlink, update, update