Format des Nombres 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#. Liens de documentation associés Voir sur Github Tutoriel connexe Guide pratique connexe Documentation de classe Télécharger IronXL DLL Signaler un problème sur cette page Prêt à commencer? Nuget Téléchargements 1,686,155 | Version : 2025.11 vient de sortir Téléchargement gratuit NuGet Total des téléchargements :1,686,155 Voir Licences
Testez dans un environnement en direct Testez en production sans filigranes.Fonctionne où que vous en ayez besoin.
Produit entièrement fonctionnel Profitez de 30 jours de produit entièrement fonctionnel.Configurez-le et faites-le fonctionner en quelques minutes.
Testez dans un environnement en direct Testez en production sans filigranes.Fonctionne où que vous en ayez besoin.
Produit entièrement fonctionnel Profitez de 30 jours de produit entièrement fonctionnel.Configurez-le et faites-le fonctionner en quelques minutes.