我正在使用 Apache POI 创建一个 docx 文档,并且我希望将边距设置为缩小,就像在 MS Word 中使用“布局”>“边距”>“缩小”一样。
我已经看到其他一些建议 RecordInputStream 的答案,但我不知道如何将它集成到我的代码中,因为它使用 FileInputStream 作为参数。
我使用 ByteArrayOutputStream 是因为我正在使用 omnifaces 导出它,并且我想要一种使其工作的方法。
这是我的代码:
ByteArrayOutputStream output = new ByteArrayOutputStream();
XWPFDocument document = new XWPFDocument();
XWPFParagraph titleParagraph = document.createParagraph();
//some code here...
document.write(output);
document.close();
Faces.sendFile(output.toByteArray(), wordFilename, true);
请帮忙。提前致谢!
青春有我
相关分类