Currency Formatting

Im using Aspose and using the style as Aspose.Cells.Style i need to format a colum as currency please let me know the mehtod

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please use the following code to apply your desired currency formatting. Please also download and use the latest version: Aspose.Cells
for .NET v7.3.4.2


I have attached the output xlsx file generated using the following code. Please also see the screenshot for your reference.

C#


Workbook workbook = new Workbook();


Worksheet worksheet = workbook.Worksheets[0];


Style style = workbook.CreateStyle();

style.Custom = “"$"#,##0.00”;

style.Custom = “"$"#,##0.00”;


//Access colum A

Column column = worksheet.Cells.Columns[0];


StyleFlag flag = new StyleFlag();

flag.NumberFormat = true;


column.ApplyStyle(style, flag);


//Test values

worksheet.Cells[“A1”].PutValue(1);

worksheet.Cells[“A2”].PutValue(2);

worksheet.Cells[“A3”].PutValue(3);


workbook.Save(“output.xlsx”, SaveFormat.Xlsx);


Screenshot: