Excel 数字格式 We can use the FormatString property to format the display value of any Excel Cell or Range in C# with IronXL. Using workSheet["A2"] will only select the Range of the specified address. To access a Cell, the First() method can be used. However, the FormatString property can be set directly from both Cell and Range. Therefore, the First() method can often be omitted. More Excel number formats can be applied using the same method as shown in the code example below. How to use Excel NumberFormat in C# Download C# library to use Excel number format Load an existing Excel file with the Load method Set the FormatString property of a cell to specify the number format. Export the edited spreadsheet with the SaveAs method In this code example, the IronXL library is used to manipulate Excel files. The WorkBook.Load method loads an existing Excel file, and the workSheet["A2"] syntax selects a specific cell within the worksheet to apply formatting. The FormatString property is then set to "0.00" to ensure that the cell value is displayed with two decimal places. Finally, workbook.SaveAs saves the modified workbook to a new file. Learn to Set Excel Cell Data Formats with C#. 相关文档链接 在Github上查看 相关教程 相关操作指南 类文档 下载IronXL DLL 报告此页面的问题 准备开始了吗? Nuget 下载 1,686,155 | 版本: 2025.11 刚刚发布 免费 NuGet 下载 总下载量:1,686,155 查看许可证