title: Excel NumberFormat for on range not working using c#
body: <p>I am trying to format currency column range using this format</p>
  
  <blockquote>
    <p>NumberFormat = "$ #,##0.00";</p>
  </blockquote>
  
  <p>Every time I get this result </p>
  
  <blockquote>
    <p>£ 1,016.89</p>
  </blockquote>
  
  <p>Here is the completed function for setting columns</p>
  
  <pre><code>public void SetColumns(List&lt;ReportColumn&gt; columns)
  {
      try
      {
          int row = 9;
          int index = 10;
          int count = Report.Data.Count - 1;
          for (int i = 0; i &lt; columns.Count; i++)
          {
              switch (columns[i].Type.ToUpperInvariant())
              {
                  case ColumnSettingType.Number:
                      {
                          oRange = (Excel.Range)oSheet.Range[oSheet.Cells[index, i + 1], oSheet.Cells[index + count, i + 1]];
                          oRange.NumberFormat = "#,###,###0";
                          oRange.HorizontalAlignment = Excel.XlHAlign.xlHAlignRight;
                          break;
                      }
                  case ColumnSettingType.Currency:
                      {
                          oRange = (Excel.Range)oSheet.Range[oSheet.Cells[index, i + 1], oSheet.Cells[index + count, i + 1]];
                          var format = "$ #,##0.00";
                          oRange.NumberFormat = format; 
                          oRange.HorizontalAlignment = Excel.XlHAlign.xlHAlignRight;
                          break;
                      }
                  case ColumnSettingType.Percentage:
                      {
                          oRange = (Excel.Range)oSheet.Range[oSheet.Cells[index, i + 1], oSheet.Cells[index + count, i + 1]];
                          oRange.NumberFormat = "0.00%";
                          oRange.HorizontalAlignment = Excel.XlHAlign.xlHAlignRight;
                          break;
                      }
                  case ColumnSettingType.Date:
                      {
                          oRange = (Excel.Range)oSheet.Range[oSheet.Cells[index, i + 1], oSheet.Cells[index + count, i + 1]];
                          oRange.NumberFormat = "MM/dd/yyyy";
                          oRange.HorizontalAlignment = Excel.XlHAlign.xlHAlignRight;
                          break;
                      }
              }
              oSheet.Cells[row, i + 1] = columns[i].ColumnName;
          }
      }
      catch (Exception ex)
      {
          throw ex;
      }
  }
  </code></pre>
  
  <p>Need help what I am doing wrong aur need to setup some culture with it.</p>