title: C# / Excel: Convert Excel Range to Array with Correct Data Type
body: <p>I opened *.htm file with Excel Application (<code>Microsoft.Office.Interop.Excel</code>). It was parsed excellent! So I can work with it. For more speed, I'm trying to get data from Excel Range and insert into System.Array and work with it:</p>
  
  <pre><code>Excel.Range range = ExcelWorksheet.get_Range("A1", "H1500"); // get all values
  System.Array dataArray = (System.Array)(range.Cells.Value2); // insert into array
  </code></pre>
  
  <p>Problem is with data type. If Excel cell has time or date format, <code>range.Cells.Value2</code> makes:<br/>
  12.06.2012 to    41072 (Excel Cell Type - date) <br/>
  14:48      to    0,616666666666667 (Excel Cell Type - time)<br/>
  If I get single value form Excel Cell, I get correct value (with <code>Cells.Text.ToString()</code>):<br/></p>
  
  <pre><code>ExcelWorksheet.get_Range("A1", "A1").Cells.Text.ToString()
  </code></pre>
  
  <p>Task: I need get values from Excel Sheet as they are, just like text, not as another type. <br/>And don't want Excel thinks instead of me :)</p>