aspose file tools*
The moose likes Java in General and the fly likes to print a table in word(.doc file) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "to print a table in word(.doc file) " Watch "to print a table in word(.doc file) " New topic
Author

to print a table in word(.doc file)

praveen shinde
Ranch Hand

Joined: Jun 03, 2009
Posts: 63
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

Joined: Oct 25, 2008
Posts: 2700

What have you tried? Where did you fail? ShowSomeEffort.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Soumyajit Hazra
Ranch Hand

Joined: Jun 26, 2007
Posts: 136
Read some thing regarding Apache POI API. It may help you.


Java Programmer | SCJP 1.5 | SCWCD 1.4
praveen shinde
Ranch Hand

Joined: Jun 03, 2009
Posts: 63
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

Joined: Oct 27, 2005
Posts: 19670
    
  18

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
praveen shinde
Ranch Hand

Joined: Jun 03, 2009
Posts: 63
Is it possible to create a table in word document which contains the values extracted from the database using java?
Thanks
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
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

Joined: Jun 03, 2009
Posts: 63
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

Joined: Aug 30, 2009
Posts: 217
What have you tried? Where did you fail? ShowSomeEffort


Vinod Kumar Nair
"Any fool can write code that a computer can understan. Good programmers write code that humans can understand."
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: to print a table in word(.doc file)