Hi,
You can achieve this as prasad explained above. But why don't you give a try using simple asp.net. .NET have very good features for microsoft related stuffs. using simple controls you can achieve this. Below is the code for importing a grid in excel-
Response.ClearContent();
Response.Buffer = true;
Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "demo.xls"));
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
gvDetails.AllowPaging = false;
BindGridview();
gvDetails.HeaderRow.Style.Add("background-color", "#FFFFFF");
for (int i = 0; i < gvDetails.HeaderRow.Cells.Count; i++)
{
gvDetails.HeaderRow.Cells[i].Style.Add("background-color", "#df5015");
}
gvDetails.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
Thanks,
Ashutosh Jha
http://tricksroad.com