title: Set Excel Column to Text (Exporting Data in DataGridView to Excel)
body: <p>I'm exporting data from DataGridView to Excel. Everything works great but when a data in columns have, for example: 000115455, Excel is ignoring the '0' and inserting 115455. I try next:</p>
  
  <ul>
  <li>Format the column in DataTable before Fill DataGridView</li>
  <li>Casting data retrieve from database as VARCHAR.</li>
  <li>Format the column in DataGridView after Fill.</li>
  <li>Using Range.EntireColumn, Range.Cells.NumberFormat and other ways in my method.</li>
  </ul>
  
  <p>None of this works! </p>
  
  <p>Below the piece of code that export to excel and save the file</p>
  
  <pre><code>ExcelApp = new Microsoft.Office.Interop.Excel.Application();
  ExcelLibro = ExcelApp.Workbooks.Add(misDatos);
  ExcelHoja = (Excel.Worksheet)ExcelLibro.Worksheets.get_Item(1);
  Excel.Range rangoHoja = (Excel.Range)ExcelHoja.Cells[1, 1];
  rangoHoja.Select();
  ExcelHoja.PasteSpecial(rangoHoja, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, true);
  ExcelLibro.SaveAs(opcionSFD.FileName, 
                                    Excel.XlFileFormat.xlWorkbookNormal,
                                    misDatos,
                                    misDatos, 
                                    misDatos, 
                                    misDatos, 
                                    Excel.XlSaveAsAccessMode.xlExclusive, 
                                    misDatos, 
                                    misDatos, 
                                    misDatos, 
                                    misDatos,
                                    misDatos);
  
                  ExcelApp.DisplayAlerts = true;
                  ExcelLibro.Close(true, misDatos, misDatos);
                  ExcelApp.Quit();
  </code></pre>
  
  <p>What I can do?</p>