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...
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;
}
Open in new window
http://www.codeproject.com/KB/aspnet/ExportClassLibrary.aspx