title: How to set custom format for cells like datetime in infragistics excel when exporting data to excel
body: <p>I am doing a export to excel using infragistics excel .
  And I want to set the column type of the excel same as the column type of the db.Means if column type is datetime it should create datetime column in the infragistics excel sheet.</p>
  
  <p>I tried below code .</p>
  
  <pre><code> Infragistics.Documents.Excel.Workbook workbook = new Infragistics.Documents.Excel.Workbook();
  
          // Create the worksheet to represent this data table
          Infragistics.Documents.Excel.Worksheet worksheet = workbook.Worksheets.Add(dtReportData.TableName);
  
          // Create column headers for each column
          for (int columnIndex = 0; columnIndex &lt; dtReportData.Columns.Count; columnIndex++)
          {
              worksheet.Rows[0].Cells[columnIndex].Value = dtReportData.Columns[columnIndex].ColumnName;
          }
  
          // Starting at row index 1, copy all data rows in
          // the data table to the worksheet
          int rowIndex = 1;
          foreach (DataRow dataRow in dtReportData.Rows)
          {
              Infragistics.Documents.Excel.WorksheetRow row = worksheet.Rows[rowIndex++];
  
              for (int columnIndex = 0; columnIndex &lt; dataRow.ItemArray.Length; columnIndex++)
              {
                  row.Cells[columnIndex].Value = dataRow.ItemArray[columnIndex];
  
                  if (dtReportData.Columns[columnIndex].DataType == Type.GetType("System.Decimal"))
                  {
  
                      //Here column should be of type decimal.   
  
                  }
                  else if (dtReportData.Columns[columnIndex].DataType == Type.GetType("System.DateTime"))
                  {
                     //Here column type should be of type datetime.                        
                  }
  
              }
  </code></pre>
  
  <p>Can anybody help me on this please..</p>