title: How to specify format for individual cells with Excel.Range.set_Value()
body: <p>When I write a whole table into an excel worksheet, I know to work with a whole Range at once instead of writing to individual cells.  However, is there a way to specify format as I'm populating the array I'm going to export to Excel?</p>
  
  <p>Here's what I do now:</p>
  
  <pre><code>object MissingValue = System.Reflection.Missing.Value;
  Excel.Application excel = new Excel.Application();
  int rows = 5;
  int cols = 5;
  int someVal;
  
  Excel.Worksheet sheet = (Excel.Worksheet)excel.Workbooks.Add(MissingValue).Sheets[1];
  Excel.Range range = sheet.Range("A1", sheet.Cells(rows,cols));
  object[,] rangeData = new object[rows,cols];
  for(int r = 0; r &lt; rows; r++)
  {
      for(int c = 0; c &lt; cols; c++)
      {
          someVal = r + c;
          rangeData[r,c] = someVal.ToString();
      }
  }
  range.set_Value(MissingValue, rangeData);
  </code></pre>
  
  <p>Now suppose that I want some of those numbers to be formatted as percentages.  I know I can go back on a cell-by-cell basis and change the formatting, but that seems to defeat the whole purpose of using a single Range.set_Value() call.  Can I make my rangeData[,] structure include formatting information, so that when I call set_Value(), the cells are formatted in the way I want them?</p>
  
  <p>To clarify, I know I can set the format for the entire Excel.Range object.  What I want is to have a different format specified for each cell, specified in the inner loop.</p>