Syncfusion.XlsIO.Base
Example 


Syncfusion.XlsIO Namespace > IRange Interface : NumberFormat Property

NumberFormat Property (IRange)

Gets or sets format of cell which is similar to Style.NumberFormat property.
Syntax
'Declaration
 
Property NumberFormat As String
'Usage
 
Dim instance As IRange
Dim value As String
 
instance.NumberFormat = value
 
value = instance.NumberFormat
string NumberFormat {get; set;}
Remarks
Gets NULL if all cells in the specified Range don't have the same number format.
Example
The following code illustrates how to set NumberFormat property.
using Syncfusion.XlsIO;           
            
class Program
{
    static void Main()
    {
        using (ExcelEngine excelEngine = new ExcelEngine())
        {
            //Create worksheet
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Create(1);
            IWorksheet worksheet = workbook.Worksheets[0];
            
            //Load data
            worksheet["C2"].Value = "3100.23";
            
            //Set number format
            worksheet["C2"].NumberFormat = "#,##0.##";
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 16.4460.0.40

See Also