【发布时间】:2018-06-14 08:18:24
【问题描述】:
我正在使用最新的 docx4j (3.3.7) 并生成表格,其中包含一个带有旋转 90 度文本的单元格。 docx 输出是正确的,但是当导出到 pdf 时,此单元格中的文本不会旋转,只是常规的从左到右的方向。
Plutext 的商业 PDF 转换器(默认启用)和docx4j-export-fo 的行为相同。
如何强制表格单元格中的文本旋转?
我用于在 tableCell 中旋转文本的代码(在 docx 中工作正常,在 pdf 导出期间被忽略):
TcPr tableCellProperties = tableCell.getTcPr();
if (tableCellProperties == null) {
tableCellProperties = new TcPr();
tableCell.setTcPr(tableCellProperties);
}
TextDirection td = new TextDirection();
td.setVal("tbRl");
tableCellProperties.setTextDirection(td);
我也试过了,效果一样:
TextDirection td = new TextDirection();
td.setVal("tbRl");
paragraph.setPPr(new PPr());
paragraph.getPPr().setTextDirection(td);
我正在使用方法导出为 PDF:
Docx4J.toPDF(wordprocessingMLPackage, fileOutputStream);
【问题讨论】:
标签: pdf pdf-generation docx4j export-to-pdf