This example prevents page or column breaks between the second and the third paragraph.
TextParagraph paragraph = document.getParagraphs().item(2); paragraph.setPageBreakBefore(false);
Related information
PageBreakBefore property