2013-05-15 2 views
0

일부 데이터가있는 표가 있습니다. 한 열에 대해 사용자에게 더 잘 보이도록 이미지가 추가되었습니다. 이제는 엑셀 시트를 내보내기위한 내보내기 옵션이 있습니다. in 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(); 
+0

내 이미지는 어느 셀입니까? –

+0

5 개 항목 템플릿의 이미지 – charan

답변

2

아무리 표시하고 싶지 않다면 모든 셀을 반복하여 셀의 내용이 그림인지 확인할 수 있습니다. if(Table.Cell(row,col).GetType().Equals("msoPicture")) 다음 셀의 내용을 null 또는 원하는 값으로 설정합니다. 사진이 필요한 경우에도 임시 파일에 저장하거나 클립 보드에 복사 할 수 있습니다 (불량).

관련 문제