• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Dynamic table in word doc using apache poi

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic