web application load xls file ?

T

tomo

I have a web application, and I want to load a xls file from db (blob). How
can i do it, without using something like File file = new File(C:\...)...
Only restriction is that I can't use some hardcoded folder(for example
c:\file) to create let's say a new xls. file, it has to be some temp file on
server ?



__________ Information from ESET NOD32 Antivirus, version of virus signature database 5052 (20100423) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
L

Lew

tomo said:
I have a web application, and I want to load a xls file from db (blob). How
can i [sic] do it, without using something like File file = new File(C:\...)...
Only restriction is that I can't use some hardcoded folder(for example
c:\file) to create let's say a new xls. file, it has to be some temp file on
server ?

It needn't be any kind of file anywhere, given that it's already a
file in the DB, from what you tell us.

BLOBs map to 'byte[]' and can be accessed via 'InputStream'.
<http://java.sun.com/javase/6/docs/api/java/sql/
Blob.html#getBinaryStream()>

You probably want Apache POI.
<http://poi.apache.org/>
<http://poi.apache.org/spreadsheet/index.html>

It has ways to create an XLS document from 'InputStream'.

<http://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/
XSSFWorkbook.html#XSSFWorkbook(java.io.InputStream)>
<http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/
WorkbookFactory.html#create(java.io.InputStream)>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top