document.add(chap1);
document.add(chap2);
for(int i = 0; i < 300; i++) {
if(i == 158) {
document.add(new RtfTOCEntry("This is line 158."));
}
document.add(new Paragraph("Line " + i));
}
document.add(new RtfTOCEntry("Cell border demonstration"));
Table table = new Table(3);
RtfCell cellDotted = new RtfCell("Dotted border");
cellDotted.setBorders(new RtfBorderGroup(LwgRectangle.BOX, RtfBorder.BORDER_DOTTED, 1, new Color(0, 0, 0)));