Search code examples
c#export-to-excel

How to set cell's dataType to Number using ExcelPackage lib?


My question is probably a stupid one, but I can't find solution on my own. I've run into a problem with (ExcelPackage). Is there any way to set cell's Excel data type ? And the cell.DataType property is string so which DataTypes are allowed ? Basically I need to set numeric formatting for certain columns/cells.

Thanks for the time spend.


Solution

  • Here is a forum post that seems to answer your question: http://excelpackage.codeplex.com/discussions/50205?ProjectName=excelpackage

    It looks like the Excel document should detect which type of data you are entering into the cell but if you want to override that, the above link should help you out. Unfortunately, it isn't simple to do so.