-
Problem in accessing Excel from my Java application
Purpose : I want to show some data from my oracle database in the form of excel sheet. For this I'm using POI Toolkit
package: org.apache.poi.hssf.usermodel
which is open source code available on apache' site.
Now the problem is when I write to FileOutputStream, it works fine. But when I write to outputstream, it gives me junk values.
I have created a wraper class - ExcelGenerator and this the code I'm using in the the test jsp
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","inline;filename=sample.xls");
OutputStream os = response.getOutputStream();
FileOutputStream fs = new FileOutputStream("MyWorkbook.xls");
System.out.println("Output Stream = "+os.toString());
ExcelGenerator eg = new ExcelGenerator();
eg.createSample();
HSSFWorkbook wb = eg.getWorkBook();
wb.write(os);
wb.write(fs);
os.flush();
fs.flush();
os.close();
Any clues/ suggestions most welcome
Anirudh
-
Hi,
have a look at http://java2.5341.com/msg/44383.html and
see if it helps.
Hope this helps
Graham
Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, and if they get mad, you are a mile away and you have their shoes ;-)
http://www.grahamrobinsonsoftware.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks