1

我正在使用 XWPF 读取包含表格的 .docx 文件。在这个表中,我得到行然后单元格,然后我在里面添加一个段落,在这个段落中我添加多个运行(具有不同的字体样式)

我的问题是(我知道当单词添加新页面或超出我的范围时我无法获得......?)但我想要实现的是在我的 tableRow 或 tableCell 循环中获取当前高度是这可能吗?我的意思是这样的 squelette 代码

XWPFTableRow r = ...;
For(...){
  r.getCell(0).addNewParagraph(0).newRun().setText(...);

  // at this step of programm I want height of each cell and each paragraph, 
  // is this possible? Because each iteration my table row height increment..
}

我尝试使用 tableRow.getHeight() 来获取行高,但它总是为 0,有人知道获取行、单元格或段落的高度吗?

4

0 回答 0