mkarthik415
asked on
How to export table from the jsp to an excel sheet
I have displayed in the jsp
<table>
<TR>
<TD><%=i+1 %></TD>
<TD><%= Obect.getRollNo()%></TD>
<TD><%=Obect.getName()%></ TD>
<TD><%= Obect.getClass()%></TD>
<TD><%= Obect.getSchool()%></TD>
</TR>
<% i++;
}%>
</table>
How can I export to an excel sheel when clicked on a button
Thank you.
<table>
<TR>
<TD><%=i+1 %></TD>
<TD><%= Obect.getRollNo()%></TD>
<TD><%=Obect.getName()%></
<TD><%= Obect.getClass()%></TD>
<TD><%= Obect.getSchool()%></TD>
</TR>
<% i++;
}%>
</table>
How can I export to an excel sheel when clicked on a button
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In the JSP when the button is clicked, read the values of the table in a loop and write that to a comma seperated values file. That is the simplest solution.
ASKER
i have created a new jsp which has this code
<%
response.setContentType("a pplication /vnd.ms-ex cel");
response.setHeader("Conten t-Disposit ion", "attachment; filename=\"x.xls\"");
%>
when click on a button new excel file open but empty data how do I put my tables in his jsp so that the excel file has that data
<%
response.setContentType("a
response.setHeader("Conten
%>
when click on a button new excel file open but empty data how do I put my tables in his jsp so that the excel file has that data
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
When put it like what u have suggested dravidnsr, I get the data but with no column or rows in excel sheet
x.xls
x.xls
r u using
follwing thing in ur jsp
<style name="header" fontColor="green" fontWeight="bold"
foreground="#C9C9C9" fillPattern="solid-foregro und"/>
<style name="highlight" border="medium-dashed" borderColor="blue"/>
then its return as no borders only ....
remove this code in ur jsp and try !!
follwing thing in ur jsp
<style name="header" fontColor="green" fontWeight="bold"
foreground="#C9C9C9" fillPattern="solid-foregro
<style name="highlight" border="medium-dashed" borderColor="blue"/>
then its return as no borders only ....
remove this code in ur jsp and try !!
<cell > realated anything in jsp ????????
ASKER
there is nothing related to cell or style tag in my jsp
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
TY
http://www.vaannila.com/struts/struts-example/struts-export-jsp-to-excel-example-1.html