Aspose word for Java 21.5.0 如何获取这部分表格的宽度微信图片_20230828163640.png (17.7 KB)
@SalesDhorde, 您可以使用以下代码来获取表格宽度:
Document doc = new Document("table.docx");
LayoutCollector collector = new LayoutCollector(doc);
LayoutEnumerator enumerator = new LayoutEnumerator(doc);
Table table = doc.getFirstSection().getBody().getTables().get(0);
enumerator.setCurrent(collector.getEntity(table.getFirstRow().getFirstCell().getFirstParagraph()));
while (enumerator.getType() != LayoutEntityType.ROW)
enumerator.moveParent();
System.out.println("Table width in points: " + enumerator.getRectangle().width);