Results 1 to 3 of 3
  1. #1
    sriram6000 is offline Member
    Join Date
    Oct 2008
    Posts
    2
    Rep Power
    0

    Default setContentType() help

    hai
    am developing a web application named as Defect tracking tool.
    am using servlet.
    i have placed a link in my page. when i click it it should fetch datas from the database and then generate a .xls file(ms excel) to show the fetched datas.
    the fetched datas frm the table should be in order as it is shown in the table.
    i have used setContentType("application\vnd-ms-excel") to produce the responce as an .xls file.
    the problem is the output is not in the order as the table format.

    it looks like one below
    empNo
    empName
    empSal
    101
    xxx
    15500
    102
    yyy
    22983

    but i need the output to be like this

    empNo empName empSal
    101 xxx 15500
    102 yyy 22983

    to be displayed in the xls file.
    plz help me

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    And how did you produce the output?

    Simply setting the content type is not enough. You need to actually produce that type of content. Setting the type to excel, but simply producing text is not going to work.

    Google for "Andy Khan JExcel" for an API that will let you actually produce an excel document.

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    If you want more text on a single line, don't output new line characters between the texts you want on the same line.

Similar Threads

  1. response.setContentType
    By bbq in forum Java Servlet
    Replies: 3
    Last Post: 01-17-2012, 05:37 PM

Posting Permissions

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