wood burning stoves
The moose likes Servlets and the fly likes displaying the data from oracle in excel sheet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "displaying the data from oracle in excel sheet" Watch "displaying the data from oracle in excel sheet" New topic

displaying the data from oracle in excel sheet

srinivas srini

Joined: Feb 03, 2004
Posts: 23
hi all,
im using servlets for fetching the data from oracle , i want to display the data which i get from orcle in excel sheet. A code snippet regarding this is highly appreciated...
Thanks in advance
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
you can check out the POI project from jakarta. With that you are able to create an excel sheet which you can send back to the client.
POI is only responsible for creating an excel file, then simply put it into
the response stream of the servlet or whatever you use. (Don't forget to set the response type)
Rafa Moreno
Ranch Hand

Joined: Nov 19, 2002
Posts: 53
Searching the same, sometime I found a place with some directions to do it:
1.- create a excel page
2.- save it as an htm document
3.- base the pages needed ond the page generated
I found that if the page is open on IE, it's opened like an excel page
some code
<%@ page contentType="application/vnd.ms-excel" %>
<html xmlns ="urn:schemas-microsoft-com ffice ffice"
xmlns:x="urn:schemas-microsoft-com ffice:excel"
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 9">
<body link=blue vlink=purple>
<table x:str border=0 cellpadding=0 cellspacing=0 width=240 style='border-collapse:
<col width=80 span=3 style='width:60pt'>
<tr height=17 style='height:12.75pt'>
<td height=17 width=80 style='height:12.75pt;width:60pt'>Enero</td>
<td width=80 style='width:60pt'>Febrero</td>
<td width=80 style='width:60pt'>Marzo</td>
<tr height=17 style='height:12.75pt'>
<td height=17 align=right style='height:12.75pt' x:num>100</td>
<td align=right x:num>150</td>
<td align=right x:num>250</td>
<tr height=17 style='height:12.75pt'>
<td height=17 align=right style='height:12.75pt' x:num>150</td>
<td align=right x:num>280</td>
<td align=right x:num>300</td>
<![if supportMisalignedColumns]>
<tr height=0 style='display:none'>
<td width=80 style='width:60pt'></td>
<td width=80 style='width:60pt'></td>
<td width=80 style='width:60pt'></td>
Try it
I agree. Here's the link: http://aspose.com/file-tools
subject: displaying the data from oracle in excel sheet
It's not a secret anymore!