Hello,
if I have two lists, how do I reset the numbering to start at 1?
Example:
1. a
2. a
3. a
1. b
2. b
3. b
In the example below, the second list continues counting:
..
4. b
5. b
6. b
public class Example {
private static XWPFNumbering numbering;
public static void main(String[] args)throws Exception
{
XWPFDocument document= new XWPFDocument();
FileOutputStream out = new FileOutputStream(new File("test.docx"));
numbering = document.createNumbering();
XWPFParagraph paragraph;
for(int i = 1; i <= 6; i++) {
paragraph = document.createParagraph();
BigInteger numId = numbering.addNum(BigInteger.valueOf(0));
paragraph.setNumID(numId);
paragraph.getCTP().getPPr().getNumPr().addNewIlvl().setVal(BigInteger.valueOf(1));
XWPFRun run=paragraph.createRun();
run.setText(String.valueOf(i));
if(i == 3) {
// Reset numbering. Start by 1.
* // ..*
}
}
document.write(out);
out.close();
}
}
Thanks!