Hi <br>I have a requirement in which I need to format a cell to $ format and round it off to 2 decimal places and also I need to display the value in the cell as $150.54.<br>I hope I am making some sense.<br>Thanks<br><br>
Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thank you for considering Aspose.
You may set Cell.Style.Number = 7 to get your desired display format. Please see the following sample code:
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets;
//Adding the value to "A1" cell
//Setting the display format to number 17 to show currency with two decimals
worksheet.Cells["A1"].Style.Number = 7;
//Saving the Excel file
You may check the following documentation link for further details and sample codes for different display formats.
Thank You & Best Regards,