I am trying to format a column to two decimal places.
Hi,
Thanks for your posting and using Aspose.Cells for .NET.
Please download and use the latest version: Aspose.Cells
for .NET v7.3.4.1. It works fine and displays correct results.
Please see the following test code. I have attached the output xlsx file and the screenshot for your reference.
C#
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Aspose.Cells.Style numeric_style = workbook.CreateStyle();
numeric_style.Number = 2;
Column ColumnB = worksheet.Cells.Columns[1];
StyleFlag flag = new StyleFlag();
flag.NumberFormat = true;
ColumnB.ApplyStyle(numeric_style, flag);
//Enter some test value in cell B2
worksheet.Cells[“B2”].PutValue(23);
workbook.Save(“output.xlsx”, SaveFormat.Xlsx);
Screenshot: