문제

RadGridView에 대한 항목 소스는 클래스이며 그리드는 2 개 중 약 20 개의 열이 BOOL 열입니다.BOOL 열에서 값이 참이면 우리는 이미지를 표시하고 있습니다.

              public bool IsPassed {get;set;}
              pulbic bool HasStructNumber {get;set;}
.

Excel로 내보낼 때 위 값이 사실 인 경우 " * "과 같은 문자열을 표시하려고합니다.이 작업을 수행하는 방법?

public static string ToExcelML(this GridViewDataControlsource,IEnumerable items, bool includeHeader, bool includeFooter);
.

RadgridView 인스턴스 에서이 메서드를 호출합니다.

      RadGridView rg;
     rg.ToExcelML(grid.SelectedItems, true, false);
.

도움이 되었습니까?

해결책

헤더를 재정의하지 않으려면 e.element가 exportelement.cell 일 때만 e.value를 변경해야합니다.

private void clubsGrid_ElementExporting(object sender,GridViewElementExportingEventArgs e)
  {
   if (e.Element == ExportElement.Cell)
     {
       var column = e.Context as GridViewDataColumn;
       if (column != null && column.Header.ToString()=="IsPassed")
         {
            if (e.Value == true)
             {
               e.Value = "Yes";
             }
       }
   }
.

}

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top