File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Record not getting properly displayed in excel through java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Record not getting properly displayed in excel through java code" Watch "Record not getting properly displayed in excel through java code" New topic
Author

Record not getting properly displayed in excel through java code

juanschodiger jha
Greenhorn

Joined: Mar 25, 2012
Posts: 8
FoodCoupon cr_details = new FoodCoupon();
String company = request.getParameter("report");
allData = cr_details.getEmployees(pageContext,company);

int count=0;
count = allData.size();
int rowno = count/10;

if(allData.size()>0)
{
out.write("<table width=100% border=1 cellpadding=1 cellspacing=1>");
out.write("<tr>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"EMPLOYEE_ID"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"CARD_NUMBER"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"PAYROLL_CITY"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"PAYROLL_LOCATION"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"CURRENT_CITY"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"CURRENT_LOCATION"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"WAGETYPE"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"VENDOR"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"AMOUNT"+"</font></td>");
out.write("<td bgcolor= #3366CC><font color=#FFFFFF>"+"DATE OF JOINING"+"</font></td>");
out.write("</table >");
out.write("<table width=100% border=1 cellpadding=1 cellspacing=1 >");

for (int counter=0;counter<rowno;counter++)
{
out.write("<tr>");
for (int i =0; i<10;i++)
{
out.write("<td>");
out.write(allData.get(counter*10+i).toString());
out.write("</td>");
}
out.write("</tr>");
}
out.write("</table>");


}


All records are not properly getting diaplayed in excel.After 6757 records nothing is getting dispalyed.
Please suggest how to resolve this error.Thank you.



[Thumbnail for attachment.JPG]

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61198
    
  66

Is this code in a JSP?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
juanschodiger jha
Greenhorn

Joined: Mar 25, 2012
Posts: 8
Yes above code is in jsp page...........i m not finding any reason why there is a split..
nagi ponnaganti
Greenhorn

Joined: Nov 22, 2009
Posts: 4
I'm really not sure what you are trying to do.. are you trying to display a table on the JSP page and after that copy all the data from the browser to paste it in excel?
if you want to create an xls from the data you have, you should probably go for apache poi jar where you would have more control on formatting cells.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61198
    
  66

There should be no Java code in a JSP. Please read this JspFaq entry.

In particular, putting HTML inside Java inside a JSP is ludicrous! The whole purpose of JSP is so that the HTML markup can be part of the template text.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Record not getting properly displayed in excel through java code