Cell Padding not working
<p>I am using <em>GridView</em> to export a table to Excel.</p>

<p>I have this in my controller:</p>

<pre><code>GridView gv = new GridView();

gv.DataSource = lstExportedExcel.ToList(); // lstExportedExcel does have stuff in it
gv.DataBind();

gv.HeaderRow.Cells[0].BackColor = System.Drawing.Color.LightCyan;
gv.HeaderRow.Cells[1].BackColor = System.Drawing.Color.LightCyan;
gv.HeaderRow.Cells[2].BackColor = System.Drawing.Color.LightCyan;
gv.HeaderRow.Cells[3].BackColor = System.Drawing.Color.LightCyan;
gv.HeaderRow.Cells[4].BackColor = System.Drawing.Color.LightCyan;
gv.HeaderRow.Cells[5].BackColor = System.Drawing.Color.LightCyan;
gv.HeaderRow.Cells[6].BackColor = System.Drawing.Color.LightCyan;
gv.HeaderRow.Cells[7].BackColor = System.Drawing.Color.LightCyan;
gv.HeaderRow.Cells[8].BackColor = System.Drawing.Color.LightCyan;
gv.HeaderRow.Cells[9].BackColor = System.Drawing.Color.LightCyan;
gv.HeaderRow.Cells[10].BackColor = System.Drawing.Color.LightCyan;
gv.HeaderRow.Cells[11].BackColor = System.Drawing.Color.LightCyan;
gv.HeaderRow.Cells[12].BackColor = System.Drawing.Color.LightCyan;

gv.CellPadding = 10; //doesn't work

Response.ClearContent();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment; filename=DailySummaryExport.xls");
Response.ContentType = "application/ms-excel";
Response.Charset = "";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
gv.RenderControl(htw);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();
</code></pre>

<p>I have done research on this, and a lot of the solutions are on the <em>front-end</em>, but how do I get this to work?  When I open the excel spreadsheet, the text in each cell isn't getting the padding from the default border.</p>

<p>Any help is appreciated.    </p>