praneethkavula
asked on
How do I save a Table generated using ASP.net into an Excel File?
I am generating a formatted table in the form of HTML to add that in a panel, this was working fine to display the table in the required format.
No my requirement is to save the formatted table in a excel file in the server and send that as an email attachment.
My requirement is to save the table in a excel file programatically and send that file as an email attachment
Thanks...
No my requirement is to save the formatted table in a excel file in the server and send that as an email attachment.
My requirement is to save the table in a excel file programatically and send that file as an email attachment
Thanks...
Table tblDailyDetailPayrollReport = ddReport.createReport();
if(tblDailyDetailPayrollReport != null)
{
pnlReport.Controls.Add(tblDailyDetailPayrollReport);
try
{
string sTableStart = @"<HTML><BODY><TABLE Border=1>";
string sTableEnd = @"</TABLE></BODY></HTML>";
StringBuilder sTableData = new StringBuilder();
for(int iRows = 0 ; iRows < tblDailyDetailPayrollReport.Rows.Count ; iRows++)
{
sTableData.Append(@"<tr>");
for(int iCols = 0; iCols < tblDailyDetailPayrollReport.Rows[iRows].Cells.Count; iCols++)
{
sTableData.Append(@"<td>");
sTableData.Append(tblDailyDetailPayrollReport.Rows[iRows].Cells[iCols].Text);
sTableData.Append(@"</td>");
}
sTableData.Append(@"</tr>");
}
string sTable = sTableStart + sTableData.ToString() + sTableEnd;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you have your answer, close the question.
http://www.codeproject.com/KB/aspnet/ExportClassLibrary.aspx