Two Laptop Bag*
The moose likes Java in General and the fly likes Exporting from Java to MS Word and MS Excel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Exporting from Java to MS Word and MS Excel" Watch "Exporting from Java to MS Word and MS Excel" New topic
Author

Exporting from Java to MS Word and MS Excel

Trinity Graham
Greenhorn

Joined: Nov 06, 2001
Posts: 1
Hi! Is it possible to export data from a Java application to MS Word and MS Excel? If it's possible, how do you do it? We are currently working on a project that uses Java and our application needs to generate reports in MS Word aand MS Excel. Unfortunately, I am completely clueless how to go about this report generation thing. Could anyone please help me? Do you know of any sites where I can get specific information on how to export data from java to MS Word and Excel? Thanks so much.
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

The easiest way to do this for Excel is to output your data as comma-separated values, and pop a .csv on the end of the file name. Excel recognizes this format and will tabularize it for you, but be careful about fields with internal whitespace -- Excel may not handle those as you'd expect.
I'm not sure what you mean by Word format. Do you also want a table for that?
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Kris Nelson
Ranch Hand

Joined: Nov 04, 2001
Posts: 35
I may be crazy, but I remember reading that MS Word actually uses XML for formatting it's documents. I'll try to track down the source, but if someone else has heard of such a thing, back me up.

------------------
WebNelly.com
Java/XML Web Development
Check it out!
http://www.webnelly.com


WebNelly.com<br />Java/XML Web Development<br />Check it out!<br /><a href="http://www.webnelly.com" target="_blank" rel="nofollow">http://www.webnelly.com</a>
Colin Kenworthy
Ranch Hand

Joined: Aug 06, 2001
Posts: 88
Word can open a .htm or .html file so you could create/format your report with standard html tags.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exporting from Java to MS Word and MS Excel
 
Similar Threads
How to open other windows application through java??
excel data
Java MySQL MS Excel
exporting to CSV
how to export data to Excel