简体   繁体   English

Apache POI-Word(docx)文档中的多列

[英]Apache POI - multiple columns in a Word (docx) document

I'm trying to create a word document with multiple columns. 我正在尝试创建具有多列的Word文档。 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 ? 可以使用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")));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM