Hi guys,
I have the following code:
final Document doc = new Document(BASE_PATH + "Test Report.docx");
final DocumentBuilder documentBuilder = new DocumentBuilder(doc);
final Cell cell = (Cell) documentBuilder.getCurrentSection()
.getBody()
.getTables()
.get(0)
.getChildNodes(NodeType.CELL, true)
.get(5);
documentBuilder.moveTo(cell.getLastParagraph());
documentBuilder.insertHtml("<h1>This is a header test</h1>");
doc.updateFields();
doc.save(BASE_PATH + "result.docx");
Files.zip (67.2 KB)
and the index of result.docx has the “This is a header test” text as another header (we have a scenario where this text also has the numbering before).
My question is: Is this text suppose to be on the index? Why in some cases these fields keep the numbering and other cases don’t?
Best regards,
Hugo Freixo