我找不到在我的 Java 程序中使用 XWPFDocument (Apache POI) 在 Docx 中制作 RTL 段落的方法。这是我生成 XWPFDocument 的代码。
XWPFParagraph title = document.createParagraph();
title.setAlignment(ParagraphAlignment.CENTER);
title.setVerticalAlignment(TextAlignment.CENTER);
title.setWordWrap(true);
XWPFRun titleRun = title.createRun();
titleRun.setText(reportDesign.getName());
XWPFTable s = document.createTable(resultList.size()+1, columnList.size());
// declare a row object reference
XWPFTableRow r = s.getRow(0);
// declare a cell object reference
XWPFTableCell c = null;
// create columnList.size() cells (0-(columnList.size()-1))
for (int cellnum = 0; cellnum < columnList.size(); cellnum++) {
c = r.getCell(cellnum);
c.setColor("c9c9c9");
c.setVerticalAlignment(XWPFVertAlign.CENTER);
c.setText(columnList.get(cellnum).getColumnHeader());
}
// create a sheet with resultList.size() rows (1-resultList.size())
for (int rownum = 0; rownum < resultList.size(); rownum++) {
// create a row
r = s.getRow(rownum+1);
// create columnList.size() cells (0-(columnList.size()-1))
for (int cellnum = 0; cellnum < columnList.size(); cellnum++) {
c = r.getCell(cellnum);
Object value = resultList.get(rownum).get(columnList.get(cellnum).getColumnKey());
if (value != null) {
c.setText(value.toString());
} else {
c.setText("");
}
}
}
你能帮帮我吗?是否有一种合乎逻辑的方式来扩展 POI(或类似的解决方案)以获得此功能?