Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2013
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1.  
  2. ...
  3.     foreach (DataRow row in data.Rows)
  4.             {
  5.                 IRow dataRow = mainSheet.CreateRow(rowIndex);
  6.  
  7.                 foreach (DataColumn column in data.Columns)
  8.                 {
  9.                     ICell cell = dataRow.CreateCell(column.Ordinal);
  10.  
  11.                     if (row[column] is string)
  12.                     {
  13.                         cell.SetCellValue((string)row[column]);
  14.                         //cell.SetCellType(CellType.STRING);
  15.                     }
  16.                     else if (row[column] is uint)
  17.                     {
  18.                         cell.SetCellValue((uint)row[column]);
  19.                        // cell.SetCellType(CellType.NUMERIC);
  20.                     }
  21.                     else if (row[column] is int)
  22.                     {
  23.                         cell.SetCellValue((int)row[column]);
  24.                         //cell.SetCellType(CellType.NUMERIC);
  25.                     }
  26.                    
  27.                     cell.CellStyle = cellStyle;
  28.                 }
  29.  
  30.                 rowIndex++;
  31.             }
  32. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement