Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JDBC and the fly likes Conversing the result set data into XLS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Conversing the result set data into XLS " Watch "Conversing the result set data into XLS " New topic
Author

Conversing the result set data into XLS

Buddha Raju
Greenhorn

Joined: Jun 01, 2005
Posts: 15
Hi all.
I need to read the data from Oracle DB and display the results in the xls and i need to save this generated xls report into the in one more table.
If any body had code for Conversing the result set data into XLS (Excel) report. Please let me know how to do,
It will be great help for me if you send the code

Regards
Raja


Raju
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30136
    
150

Raja,
Welcome to JavaRanch!

An Excel file is just a comma delimitted file (unless you need formatting.) You just have to loop through the ResultSet and write out each line separating the fields with commas.

If you need formatting, take a look at Apache's HSSF.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Buddha Raju
Greenhorn

Joined: Jun 01, 2005
Posts: 15
IF you have some code can you send the code.

raja
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

"Raju Buddha",

There aren't may rules that have been put into place here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Buddha Raju
Greenhorn

Joined: Jun 01, 2005
Posts: 15
Dear Bear
My first name is raju and last name is buddha. That's why i have used display name as buddha raju,
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

for your problem download datafile.jar from sourgeforge.net

It has pretty good handling for excel and csv, also javadocs were there on the site but i could not find the url

you can download datafile.jar from
here

Shailesh


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

here is url you can download jar file and javadocs from here

http://datafile.sourceforge.net

use its api's to generate excel files

Shailesh
Buddha Raju
Greenhorn

Joined: Jun 01, 2005
Posts: 15
Thanks Shailesh
Do you have any code to read the data from DB and generate the XLS report from the ResultSet



Raj
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

I would recommend to read javadocs provided by API, If you face any problem then many ranchers are here

here is the code for your help I picked from same api's doc, coz I used this api once for reading only

you can change for loop to your resultset's while loop




Shailesh
[ June 08, 2005: Message edited by: Shailesh Chandra ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Conversing the result set data into XLS
 
Similar Threads
Excel by email using struts framework
What is the maximum size that can hold by a String buffer object?
Converting the Resultset to XLS in jsp
problem displaying title using jasper reports plugin
generate XLS in right to left direct using jasper