开发者

Referencing cells in XWPFTable with Apache POI

开发者 https://www.devze.com 2023-03-23 14:40 出处:网络
I\'m writing a docx parser with Apache\'s POI library.I\'m having som开发者_StackOverflowe trouble understanding how cells are referenced within a XWPFTable.Can someone explain how the referencing is

I'm writing a docx parser with Apache's POI library. I'm having som开发者_StackOverflowe trouble understanding how cells are referenced within a XWPFTable. Can someone explain how the referencing is done if non uniform tables are presented (ie two columns with different number of rows).


POI XWPF will give you the cells in the order that Word has stored them in the file. It's as (deceptively!) simple as that...

To check what word does, one option it just to use POI and see what you get. The other is to unzip the word file - a .docx is simply a special zip of xml files. Look at the document XML and see how Word has decided is the best way to store your complex set of table cells. Then, ask POI for them, and you should get the same ordering!

0

精彩评论

暂无评论...
验证码 换一张
取 消