web application load xls file ?

Discussion in 'Java' started by tomo, Apr 23, 2010.

  1. tomo

    tomo Guest

    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
     
    tomo, Apr 23, 2010
    #1
    1. Advertising

  2. tomo

    Lew Guest

    tomo wrote:
    > 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)>
     
    Lew, Apr 23, 2010
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sachin
    Replies:
    1
    Views:
    376
    Tjerk Wolterink
    Dec 1, 2005
  2. Steve
    Replies:
    3
    Views:
    27,113
    Steve
    Aug 25, 2006
  3. Fonzie

    downloading .xls files from the web

    Fonzie, Feb 7, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    386
    Chris Mahoney
    Feb 8, 2007
  4. john

    XLS to web ?

    john, Oct 5, 2010, in forum: Java
    Replies:
    0
    Views:
    268
  5. win2kcowboy
    Replies:
    1
    Views:
    182
    Ray Costanzo [MVP]
    May 25, 2005
Loading...

Share This Page