title: Adding currency format in excel export using NPOI dll - not working
body: <p>I am exporting data in excel file using NPOI dll.</p>
  
  <p>The data is of amount type that has to be shown in money format: $#,###.##
  and also in date format.</p>
  
  <p>I've added the format to the cells. but the data is not exporting to Excel as a Money/date format</p>
  
  <p>Any answers for it?</p>
  
  <p>here is my code:</p>
  
  <p>I've tried all the kinds of currecy formats that I found in Google search but nothing worked,
  it still exporting to Excel as a text and not a currency / date type</p>
  
  <pre><code>public enum StyleDataTypes { NotDeclared = 0, Money = 1, Percentage = 2, Number = 3, Date = 4 }
  
       public class ColumnInfoAttribute : Attribute
  
  
   {
  
  
      private string displayNoValue = "";
  
      public string DisplayNoValue
      {
          get { return displayNoValue; }
          set { displayNoValue = value; }
      }
  
      private StyleDataTypes styleType = StyleDataTypes.NotDeclared;
  
      public StyleDataTypes StyleType
      {
          get { return styleType; }
          set { styleType = value; }
      }
  
  }
  
  
  IDataFormat dataFormatCustom = sheet.Workbook.CreateDataFormat();
  
              ICellStyle dateStyle = sheet.Workbook.CreateCellStyle(); //date
              dateStyle.DataFormat = dataFormatCustom.GetFormat("yyyy/MM/dd HH:mm:ss");
  
              ICellStyle amountStyle = sheet.Workbook.CreateCellStyle(); //money
              amountStyle.DataFormat = dataFormatCustom.GetFormat("$#,##0.00");
  
    StyleDataTypes dataType = ((ColumnInfoAttribute)attr).StyleType;   
   switch (dataType)
                      {
                          case StyleDataTypes.Date:
                             cell.CellStyle.DataFormat = dateStyle.DataFormat;
                              break;
                          case StyleDataTypes.Number:
                             cell.SetCellType(CellType.Numeric);
                              break;
                          case StyleDataTypes.Percentage:
                              cell.CellStyle.DataFormat = percentagesStyle.DataFormat;
                              break;
                          case StyleDataTypes.Money:
                              cell.CellStyle.DataFormat = amountStyle.DataFormat;
                              break;
                      }
  </code></pre>
  
  <p>in the Excel field it showes as a text field and not custom as I did.</p>