Syncfusion.XlsIO.Base
Example 


Syncfusion.XlsIO Namespace > IExtendedFormat Interface : NumberFormatSettings Property

NumberFormatSettings Property

Returns INumberFormat object that describes number format. Read-only.
Syntax
'Declaration
 
ReadOnly Property NumberFormatSettings As INumberFormat
'Usage
 
Dim instance As IExtendedFormat
Dim value As INumberFormat
 
value = instance.NumberFormatSettings
INumberFormat NumberFormatSettings {get;}
Example
The following code illustrates how to access INumberFormat using NumberFormatSettings property.
using Syncfusion.XlsIO;
using System;
            
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];
            
            //Set text
            worksheet["C2"].Value = "1200.40";
            worksheet["E2"].Value = "1200.45";
            
            //Add style
            IStyle style = workbook.Styles.Add("CustomStyle");
            
            //Set style
            worksheet["C2"].CellStyle = style;
            
            //Set number format index
            style.NumberFormat = "#,##0.00";
            
            //Set number format settings
            INumberFormat numberFormat = style.NumberFormatSettings;
            
            //Get extended format
            IExtendedFormat format = worksheet["E2"].CellStyle;
            
            //Set number format index
            format.NumberFormat = "#,##0.00";
            
            //Set number format settings
            INumberFormat extendedNumberFormat = format.NumberFormatSettings;
            
            //Check number format decimal places
            Console.WriteLine(numberFormat.DecimalPlaces);
            Console.WriteLine(extendedNumberFormat.DecimalPlaces);
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
            Console.ReadKey();
        }
    }
}
//Output will be
//2
//2
AssemblyVersion

Syncfusion.XlsIO.Base: 17.2460.0.34

See Also