Results 1 to 6 of 6
  1. #1
    avitra is offline Member
    Join Date
    Feb 2011
    Posts
    3
    Rep Power
    0

    Default how to convert .xlsx data to .txt

    Hi

    i am getting data from .xlsx file and trying to download the data into .txt format,is this possible by wring java code

    follwing is scriptlet i hava written in jsp.

    <%
    InputStream io =new FileInputStream("E:\\Avitra\\ex3.xlsx");

    response.setContentType("text/html");

    request.setCharacterEncoding("utf-8");

    response.setHeader ("Disposition", "attachment;filename=\"myfile.txt\"");

    ServletOutputStream sosStream = response.getOutputStream();
    int ibit = 256;
    while ((ibit) >= 0)
    {
    ibit = io.read();
    sosStream.write(ibit);
    } sosStream.flush();
    sosStream.close();
    io.close();
    %>
    Last edited by avitra; 02-24-2011 at 06:59 AM.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,791
    Rep Power
    19

    Default

    Have you opened an xslx file in a text editor?
    Because that's what you would be doing here.

  3. #3
    avitra is offline Member
    Join Date
    Feb 2011
    Posts
    3
    Rep Power
    0

    Default

    hi tolls,
    could you tell the possible ways for converting,is there any api for the conversion.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,791
    Rep Power
    19

    Default

    You didn't answer my question...

    Since I don't know what you expect to see as the response from this servlet I really can't answer your question.

  5. #5
    avitra is offline Member
    Join Date
    Feb 2011
    Posts
    3
    Rep Power
    0

    Default

    yes i opened in text editor and the data is encoded format.

    my requirement is to readthe data from excel file and write the data into txt file .

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,791
    Rep Power
    19

    Default

    I expect the "write to text file" is supposed to be in some readable format.
    Since I don't know what that format is, the only thing I can suggest is using something like Apache-POI to read the Excel file and then pick out the data you want to return.

    You'll have to figure out the rest.

Similar Threads

  1. Getting problem inserting data in data base
    By anupama in forum New To Java
    Replies: 4
    Last Post: 12-15-2010, 10:03 PM
  2. data structure and data base??
    By ahmed13 in forum Advanced Java
    Replies: 8
    Last Post: 03-27-2009, 05:48 AM
  3. error while retrieving data from data base
    By kirtesh4u in forum New To Java
    Replies: 5
    Last Post: 11-15-2008, 04:10 PM
  4. Replies: 0
    Last Post: 10-31-2008, 02:13 PM
  5. Data Sorting in a .data file using java
    By stutiger99 in forum New To Java
    Replies: 2
    Last Post: 10-08-2008, 02:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •