Format cells using the Excel dropdowns

Nov 12, 2012 at 2:57 PM
Edited Nov 17, 2012 at 12:37 PM

Is it possible to define a number format using the 'Accounting' style rather than the usual currency that I usually use, which is:

ws.Column(i).Style.Numberformat.Format = "$0.00"

Thanks!

Nov 17, 2012 at 12:34 PM
Edited Nov 17, 2012 at 12:35 PM

I ended up assigning the Accounting Format and opening the file as a template with EPPLus, then reading that cell and grabbing the NumberFormat string, which is:

 _("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)

I can now assign any cell/column NumberFormat with this string, and when I open the finished Excel file it shows up perfectly for my end users as 'Accounting' style.

Nov 4, 2013 at 12:43 PM

My answer to this:

const String STR_ACCOUNTING_FORMAT = @"_(""$""* #,##0.00_);_(""$""* \(#,##0.00\);_(""$""* ""-""??_);_(@_)";
cellRange.Style.Numberformat.Format = STR_ACCOUNTING_FORMAT;
I'm not sure why but the format supplied by CellBent didn't work for me and only corrupted the file. Perhaps mine works on Excel 2013 only?