public class FieldEditTime extends Field
To learn more, visit the Working with Fields documentation article.
Remarks:
Retrieves the total editing time, in minutes, since the document was created.
Examples:
Shows how to use the EDITTIME field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// The EDITTIME field will show, in minutes,
// the time spent with the document open in a Microsoft Word window.
builder.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY);
builder.write("You've been editing this document for ");
FieldEditTime field = (FieldEditTime) builder.insertField(FieldType.FIELD_EDIT_TIME, true);
builder.writeln(" minutes.");
// This built in document property tracks the minutes. Microsoft Word uses this property
// to track the time spent with the document open. We can also edit it ourselves.
doc.getBuiltInDocumentProperties().setTotalEditingTime(10);
field.update();
Assert.assertEquals(field.getFieldCode(), " EDITTIME ");
Assert.assertEquals(field.getResult(), "10");
// The field does not update itself in real-time, and will also have to be
// manually updated in Microsoft Word anytime we need an accurate value.
doc.updateFields();
doc.save(getArtifactsDir() + "Field.EDITTIME.docx");
getDisplayResult, getEnd, getFieldCode, getFieldCode, getFormat, getLocaleId, getResult, getSeparator, getStart, getType, isDirty, isDirty, isLocked, isLocked, needStoreOldResultNodes, remove, setLocaleId, setResult, unlink, update, update