0
我有一個網格,其中包含一些數據,對於一列,我添加了圖像以提高用戶的可見度。現在我有一個導出選項將網格導出爲Excel表格。在Excel中我得到圖像未找到圖標。我不想在Excel表格中向用戶顯示圖像。任何幫助如何在導出爲Excel時刪除網格中的圖像
Response.ClearContent();
Response.Buffer = true;
Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "123.xls"));
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
// gdAclog.AllowPaging = false;
// gdAclog.DataBind();
//Change the Header Row back to white color
gdAclog.HeaderRow.Style.Add("background-color", "#FFFFFF");
//Applying stlye to gridview header cells
for (int i = 0; i < gdAclog.HeaderRow.Cells.Count; i++)
{
gdAclog.HeaderRow.Cells[i].Style.Add("background-color", "#507CD1");
}
int j = 1;
//This loop is used to apply stlye to cells based on particular row
foreach (GridViewRow gvrow in gdAclog.Rows)
{
gvrow.BackColor = Color.White;
if (j <= gdAclog.Rows.Count)
{
if (j % 2 != 0)
{
for (int k = 0; k < gvrow.Cells.Count; k++)
{
gvrow.Cells[k].Style.Add("background-color", "#EFF3FB");
}
}
}
j++;
}
gdAclog.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
哪個單元格是你的圖片? –
5項目模板圖像 – charan