I want to move table of contents node from one page to another. Need assistance to accomplish this
Shubhangi Gupta
I want to move table of contents node from one page to another. Need assistance to accomplish this
Document doc = new Document(MyDir + "in.docx");
DocumentBuilder docBuilder = new DocumentBuilder(doc);
for (Field field : doc.getRange().getFields())
{
if(field.getType() == FieldType.FIELD_TOC)
{
docBuilder.moveToField(field, false);
docBuilder.insertBreak(BreakType.PAGE_BREAK);
break;
}
}
doc.save(MyDir + "Out v16.12.0.docx");
Hi Tahir,