I am creating the content of a docx file and try to have headings above tables I create. I currently create the text like that:
XWPFParagraph newParagraph = document.insertNewParagraph(cursor);
XWPFRun run = newParagraph.createRun();
run.setText(headingCounter + ": Heading");
My problem is that this is a normal text and not a heading which also leads to the text not being shown in the table of content. How can I solve this?