How can I format a cell as a percentage value ?

Oct 26, 2010 at 5: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. =/


Oct 26, 2010 at 5:56 PM

I found out, it was very simple...

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