We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to set cell format to Currency number?


I have a question about setting cell format. for example I have:

Cells cell = wb.worksheets[0].Cells;

cell[0, 0].PutValue = "1000";

How can I set the cell format to currency number format to show the value like "$1,000.00"?

I can't find an example to tell me if there's any way to set the format like that.

Thanks so much!


Thanks for considering Aspose.

Please use Style.Custom property to set your desired currency format.

May the following sample code help you for your requirement, kindly check it out:

Workbook wb = new Workbook();
Cells cell = wb.Worksheets[0].Cells;
//cell[0, 0].PutValue("1000",true);
cell[0, 0].PutValue(1000);
Style style = wb.Styles[wb.Styles.Add()];
style.Custom = "$#,##0.00";

Thank you.

It works, thanks so much!! :)