Issue
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!
Solution
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")));
Answered By - Ivan Sopov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.