I am using apache POI for converting a word document into pdf. I am filling the table rows with dynamic data. Everything is working fine, but i want to do some enhancement that is i want to add a bullet before each row data. Here is a for loop i am using to fill the row data in the table:
for (String string : documentList) {
XWPFTableRow lnewRow = ltable.createRow();
XWPFTableCell lnewCell = lnewRow.getCell(0);
XWPFParagraph lnewPara =lnewCell.getParagraphs().get(0);
XWPFRun lnewRun = lnewPara.createRun();
lnewRun.setText(string);
}
Can anyone please tell me how can i add a bullet before each row data?
Maybe little late but I applied the solution that Axel is proposing and it works nicely.
Just had a little problem with class
CTLvlText
, returned object from methodcTLvl.addNewLvlText()
, had no way to find it out in apache-poi jars.I handled it by not introducing a next level, but setting
NumId
to the Paragraph everytime it is created new.Hope can be useful to someone!
There are multiple examples for creating
XWPFNumbering
already. Most of them are unnecessary complex in my opinion. So let's have a simplest solution:My examples are always complete examples. I have marked the part with your code and my supplements to it.