This example adds an user field at the beginning of second paragraph.
Document document = documents.openDocument("D:\\test.odt", true); TextFields fields = document.getFields(); fields.add(document.getParagraphs().item(2).getRange().getStart(), "User", "User_Defined_Field"); System.out.println(fields.getCount());
Related information