使用Apache Poi解析word文档中的表内表
我能够使用 XWPFDocument 上的 getTablesIterator() 获取 Word 文档中存在的表格。 但是有没有办法在表中获取表呢?
提前致谢, 乔尔
I was able to get the tables present in a word document using getTablesIterator() on a XWPFDocument.
But is there a way to get table within a table?
Thanks in Advance,
Joel
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 .docx 中,“表”不直接包含其他表,但表单元格可以包含。因此,您不能向表格询问其嵌套表格,您必须获取每个单元格并检查它们。
从 XWPFTable 获取 XWPFTableRow 实例,然后从那里获取 XWPFTableCell。然后您可以调用 XPWFTableCell.getTables () 获取嵌套在该单元格中的任何表格。
In .docx "Table" doesn't directly contain other tables, but a Table Cell may do. So, you can't ask a table for its nested tables, you have to get each cell and check those.
From a XWPFTable get your XWPFTableRow instances, then from there a XWPFTableCell. You can then call XPWFTableCell.getTables() to get any tables nested in that one cell.