This project has moved. For the latest updates, please go here.

How can I format a cell as a percentage value ?

Editor
Oct 26, 2010 at 4:40 PM

I've tried to open a xls file to discover how to do that but I only found a builtinId="5" in my cell format. So, I try this:

 

ws.Cells[1,4].Style.Numberformat.BuildIn = true; 

ws.Cells[1,4].Style.Numberformat.NumFmtID = 5;

but BuildIn and NumFmtId are readonly. =/

 

Editor
Oct 26, 2010 at 4:56 PM

I found out, it was very simple...

ws.Cells[1, 4].Style.Numberformat.Format = "#%";