void SetCellFormat(Excel.Cell excelCell, DataGridViewCell gridCell)
 {
     try
     {
         excelCell.NumberFormat = CellFormat(gridCell);
     } catch
     {
     }
 }
 void ExportHeaders(Excel.Worksheet worksheet)
 {
     for (int column = 0, worksheetColumn = 1; column < m_grid.ColumnCount; column++)
     {
         if (IsExportableColumn(column))
         {
             Excel.Cell currentHeader = worksheet[1, worksheetColumn++];
             currentHeader.Value     = m_grid.Columns[column].HeaderText;
             currentHeader.Font.Bold = true;
             currentHeader.AutoFitEntireColumn();
         }
     }
 }
        void ExportCells(Excel.Worksheet worksheet)
        {
            for (int column = 0, worksheetColumn = 1; column < m_grid.ColumnCount; column++)
            {
                if (IsExportableColumn(column))
                {
                    for (int row = 0; row < m_grid.RowCount; row++)
                    {
                        Excel.Cell currentCell = worksheet[row + 2, worksheetColumn];
                        currentCell.Value = CellValue(m_grid[column, row]);
                        SetCellFormat(currentCell, m_grid[column, row]);
                    }

                    worksheetColumn++;
                }
            }
        }