aspose file tools*
The moose likes Java in General and the fly likes How to read value and out put in Word document? Please, help me. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to read value and out put in Word document? Please, help me. " Watch "How to read value and out put in Word document? Please, help me. " New topic
Author

How to read value and out put in Word document? Please, help me.

Gautam Ry
Ranch Hand

Joined: Dec 30, 2008
Posts: 41
Hi
My requirement is as below:
We save template values in the html tag like <table><tr><td>Name</td></tr></table>
in MsSQL database.
Now, I need to write a java code that can read each record as mentioned above and the ultimate
out put must be in individual word document for individual record.

Another challenging task, code should be capable to read more than six lakh records
form the database table at a stretch
.

Any idea, how to proceed? Please, help me.

Regards
Gautam
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
So you need to extract data from HTML and write it to a Word document; is that correct? If so, you could use a library like NekoHTML or TagSoup to access the data in the HTML file, and then use the POI library to create a Word file. Here's an example of how to do the latter: http://faq.javaranch.com/java/CreateWordDocument

If the HTML data isn't a full document, but really just a snippet like the one you posted above, then a regular expression, or a series of string operations, should be sufficient to retrieve the data.


Ping & DNS - updated with new look and Ping home screen widget
Gautam Ry
Ranch Hand

Joined: Dec 30, 2008
Posts: 41
Please, help me. I am stuck
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1625
    
  10

Did you read the FAQ that Ulf posted earlier? Did you try the code out to see how it works? What do you have so far?


When you do things right, people won't be sure you've done anything at all.
Gautam Ry
Ranch Hand

Joined: Dec 30, 2008
Posts: 41
Hi Ulf
thanks for your reply.
My requirement is slightly different. Let me clarify again.
I need to extract data from HTML into word document as well as the
look and feel of the word document must be same as with the HTML contents
in the browser.
Another challenging part, code must be compatible enough to read more than
six lakh record from database at a stretch.

Regards
Gautam



Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
If it's full documents that you're converting, then the JODConverter library may be for you. It requires OpenOffice to be installed, but it sounds as if this is to be done on a server, so that shouldn't be a problem.

I don't understand how "compatibility" (of what?) should have an impact on performance; maybe you can elaborate.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to read value and out put in Word document? Please, help me.
 
Similar Threads
How to compare two documents in java
ArrayIndexOutOfBoundsException
Display output table
Help me to have a sortable table in my html profile!
Display each results from database in their own row