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
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
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.
If you want more text on a single line, don't output new line characters between the texts you want on the same line.