The only examples I have been able to find thus far show how to write cell by cell, but there has to be a way to just assign a value like you would do in Excel VBA:
Code
FormulaR1C1 = "ID"
Can someone please provide me with a way to perform this daunting task?
VulpesRank #55 · 29.2K reputationPosted Mar 13, 2013, 5:19 AM EDT
Satyapriya NayakRank #47 · 31.5K reputationPosted Mar 12, 2013, 6:42 PM EDT
Mahesh Mohan3 reputationPosted Mar 13, 2013, 1:58 AM EDT
protected void lnkBtnExcel_Click(object sender, EventArgs e)
{
Response.ClearContent();
Response.Buffer = true;
Response.AddHeader("content-disposition",
string.Format("attachment; filename={0}", "Customers.xls"));
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
gvCompetitor.AllowPaging = false; gvCompetitor.DataBind();
gvCompetitor.HeaderRow.Style.Add("background-color", "#FFFFFF");
gvCompetitor.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}
darma tejaRank #3,199 · 449 reputationPosted Mar 13, 2013, 2:06 AM EDT
try like this:
richard smithRank #8,268 · 225 reputationPosted Mar 13, 2013, 3:55 AM EDT