public class FieldRevNum extends Field
To learn more, visit the Working with Fields documentation article.
Remarks:
Retrieves the document's revision number, as recorded in the Revision property of the built-in document properties.
Examples:
Shows how to work with REVNUM fields.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("Current revision #");
// Insert a REVNUM field, which displays the document's current revision number property.
FieldRevNum field = (FieldRevNum) builder.insertField(FieldType.FIELD_REVISION_NUM, true);
Assert.assertEquals(" REVNUM ", field.getFieldCode());
Assert.assertEquals("1", field.getResult());
Assert.assertEquals(1, doc.getBuiltInDocumentProperties().getRevisionNumber());
// This property counts how many times a document has been saved in Microsoft Word,
// and is unrelated to tracked revisions. We can find it by right clicking the document in Windows Explorer
// via Properties -> Details. We can update this property manually.
doc.getBuiltInDocumentProperties().setRevisionNumber(doc.getBuiltInDocumentProperties().getRevisionNumber() + 1);
field.update();
Assert.assertEquals("2", field.getResult());
getDisplayResult, getEnd, getFieldCode, getFieldCode, getFormat, getLocaleId, getResult, getSeparator, getStart, getType, isDirty, isDirty, isLocked, isLocked, needStoreOldResultNodes, remove, setLocaleId, setResult, unlink, update, update