• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic table in word doc using apache poi  RSS feed

 
gopal g gupta
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I want to create a dynamic table in word doc using apache poi. So for examples - In my case there are 9 rows. In 1st row there is only 1 column. In 2nd, 4th and 5th rows there are 2 columns. In 3rd and 6th rows there are 3 columns. In 7th, 8th and 9th rows there are 7 columns. Also, how can i set the text in bold for specific cell.

Take a look at the attached snapshot for more clarification.

Please let me know the approach. Its urgent.
Test.png
[Thumbnail for Test.png]
dynamic table
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This may not be possible. While the org.apache.poi.hwpf.usermodel.TableCell class has methods to determine whether an existing cell is merged with another cell, I don't see methods that would create merged cells, or let you merge cells after they have been created.
 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you plan to use a single table then it's practically impossible. Word isn't Excel.

However, you can split the relevant rows into sections and each section is its own table. This way you can use the org.apache.poi.hwpf.usermodel.TableRow class to align each row. If you do this, not sure if there will be space between each so-called table.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!