Hi Aspose support team,
I need to set the style format numeric value with 3 decimals (like "0.000"). i used the following code, but i cannot able to achieve it. Could you please provide the sample code to achieve this functionality.
Sample code:
Style objStyle = new Style();
objStyle.Custom = "0.000";
objStyle.Font.Name = "Arial";
objStyle.Font.Size = 10;
Thanks in advance.
Regards,
Saravanan
Hi,
Thanks for your question and using Aspose.Cells for .NET
You need to call SetStyle method. Please see the following code that works fine.
Please download and use the latest version:
Aspose.Cells
for .NET v7.1.1.1
I have also attached the output file and the screenshot for your reference.
C#
Workbook workbook =
new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Cell cell = worksheet.Cells[“A1”];
cell.PutValue(2);
Style style = cell.GetStyle();
style.Custom = “0.000”;
style.Font.Name = “Arial”;
style.Font.Size = 10;
cell.SetStyle(style);
workbook.Save(@“F:\Shak-Data-RW\Downloads\output.xlsx”);
Screenshot: