Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

to print a table in word(.doc file)

 
praveen shinde
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

How do we create a word document containing a table with values using Java. The heading of the table has to be bold.
Please help!

Thanks
Praveen
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you tried? Where did you fail? ShowSomeEffort.
 
Soumyajit Hazra
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read some thing regarding Apache POI API. It may help you.
 
praveen shinde
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am able to read the values in cell from excel document. But unable to draw the table in the word document.
this is my for reading excel file


download the java library from
http://sourceforge.net/projects/jexcelapi/

Thanks
 
Rob Spoor
Sheriff
Pie
Posts: 20549
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Word and Excel, although both part of MS Office, are very different in structure. The reason you're able to put Excel tables in Word is because of OLE objects. The Word document contains a little part that is actually asking Excel to do the hard work.
 
praveen shinde
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to create a table in word document which contains the values extracted from the database using java?
Thanks
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
praveen shinde wrote:Is it possible to create a table in word document which contains the values extracted from the database using java?

Yes. You've already been pointed to the Apache POI library that can create DOC and DOCX files. But if I wanted to create complex text documents, I'd probably create an RTF template by hand, add some easily recognizable placeholders (like "<<table>>"), and then use text search/replace to fill in the actual content using RTF markup. Most text processors (and Word in particular) can read RTF just fine.
 
praveen shinde
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
After hours of googleing on net I found a javadocx which could just draw a table without adding any contents to the table. But i have to add content from database which is not supported in free version. so if anyone knows any silmilar tool please let me know.
I could not find any code on Apache POI.
Any help would highly be appreciated
Thanks
Praveen
 
Vinod Vinu
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you tried? Where did you fail? ShowSomeEffort
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic