Hi Ppl,
I am exporting the Gridview to Excel using HttpContext.Current.Response.Output.Write. In Gridview i am having the Date column. While Exporting to Excel in Excel sheet i cant able to do shorting in Datecolumn.
To know the Format of the Cell. I checked the corresponding Excel Column Formate Type, it showing as General.
If any one knows the answer pls post it..
Thank you for your Time
Arun T
Loading
Nicholas BarnsPosted May 14, 2014, 7:50 AM
Also you can try another approach by using this C# Excel library, something like the following:
Tirthak ShahPosted Dec 26, 2013, 8:11 AM
{
/* Verifies that the control is rendered */
}
protected void btnexport_Click(object sender, EventArgs e)
{
Response.ClearContent();
Response.AddHeader("content-disposition",
"attachment;filename=Candidate_Inquiry.xls");
Response.ContentType = "applicatio/excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htm = new HtmlTextWriter(sw);
gvcategory.BorderWidth = 1;
gvcategory.AllowPaging = false;
BindCategory();(Bind Your Griedview Here)
for (int i = 0; i < gvcategory.HeaderRow.Cells.Count; i++)
{
gvcategory.HeaderRow.Cells[i].Style.Add("background-color", "#CCCCCC");
gvcategory.HeaderRow.Enabled = false;
}
gvcategory.RenderControl(htm);
Response.Write(sw.ToString());
Response.End();
}
This Is the Code Try It.
It Will Definately Help You.Its Works For Me.
Thanks,
Tirthak Shah
Balakrishnan PPosted Dec 26, 2013, 6:33 AM
Arun TPosted Dec 23, 2013, 2:17 AM
Ring ZhongPosted Dec 20, 2013, 4:09 AM
http://forums.asp.net/t/1255489.aspx
ALSO
you can use another method, it's easier to operate:
refer:http://www.e-iceblue.com/Knowledgebase/Spire.XLS/Program-Guide/Data-Export-/Import-Export-Datatable-to-Excel-from-Database.html
hope it helps.