Hi guys,
Currently i'm doing Export to Excel concept. I know how to do this upto now it's working fine . But what is my question is ...
After Clicking the Exporting button one excel sheet is opened and display the total data in that but i want formated cells also...
for ex: i have a columns like ( doc, date,serial no )
now i want
doc -- uneditable mode
date -- text format
serial no -- text format
how to achieve this ....
can anyone help me out of this....
Note: Upto Now i'm doing Export DataTable data to Excel , i'm not using Grid controls
Previously i never use Interop Classes...
I tried for this past 3 days onwords can you please help me out of this to satisfy my requirement..
string attachment = "attachment; filename=EMS_BnF_Update.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/vnd.ms-excel";
string tab = "";
foreach (DataColumn dc in dsExcelUpdate.Tables[0].Columns)
{
Response.Write(tab + dc.ColumnName);
tab = "\t";
}
Response.Write("\n");
int i;
foreach (DataRow dr in dsExcelUpdate.Tables[0].Rows)
{
tab = "";
for (i = 0; i < dsExcelUpdate.Tables[0].Columns.Count; i++)
{
Response.Write(tab + dr[i].ToString());
tab = "\t";
}
Response.Write("\n");
}
Response.End();