Please help on how to create index with page numbers. Thank you.
Thank you for the reply.
Hi,
Document doc = new Document(getMyDir() + “input.docx”);
DocumentBuilder builder = new DocumentBuilder(doc);
// Get paragraph you want to append this merge field to
Paragraph para = (Paragraph)doc.getChildNodes(NodeType.PARAGRAPH, true).get(1);
// Move cursor to this paragraph
builder.moveTo(para);
FieldXE field = (FieldXE)builder.insertField(FieldType.FIELD_INDEX_ENTRY, false);
field.setText(“Test1”);
field.isBold(true);
field.setEntryType(“Test2”);
field.isItalic(true);
field.setPageRangeBookmarkName(“Test3”);
field.setPageNumberReplacement(“Test4”);
field.setYomi(“Test5”);
doc.save(getMyDir() + “awjava-16.4.0.docx”);
Sorry. I am not completely understand the solution. kindly could you please elaborate using my sample document that I attached. thank you.
Hi,
Create an index and update an index