I'm trying to create a word document with multiple columns. The reason for doing this (rather than using tables) is that the data will span multiple pages and only with columns I can fill the whole page before adding to a new one.
Can it be done with Apache POI ? Thanks!
How about using previously created empty document with multiple columns? Like this:
XWPFDocument document = new XWPFDocument(PoiTest.class.getResourceAsStream("twocolumn.docx"));
XWPFParagraph tmpParagraph = document.getParagraphs().get(0);
for (int i = 0; i < 100; i++) {
XWPFRun tmpRun = tmpParagraph.createRun();
tmpRun.setText("LALALALAALALAAAA");
tmpRun.setFontSize(18);
}
document.write(new FileOutputStream(new File("C:\\temp\\poi.docx")));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With