Free Support Forum - aspose.com

CellFormat.Number

Laurence,

I am using the CellFormat.Number to set specific cell formats. However, the predefined .Number values lack the specific format I need in some cases. I have reports that have percentages and decimal numbers with one decimal place. When I export them to Excel I can only use value 10 (0.00%) for percentages so that 3.9% converts to 3.86% and value 2 (0.00) for decimal numbers so that 1.6 converts to 1.58. Is there any way to add .Number formats to the collection like I can add a Style to the Excel.Styles collection.

My QA people complain that the exported values don’t match the original. (Picky, picky, picky).

Thanks,
Rick

These predefined number format values are defined by MS, not AsposeSad. HoweverSmile, you can set your custom number format by this:

cell.Style.Custom = “0.0%”;

Thanks, Laurence.

It also works when I’m defining my styles.

oStyle.Custom = "0.0%"

Rick