Syncfusion.XlsIO.Base
Example 


Syncfusion.XlsIO Namespace > IRange Interface : CellStyleName Property

CellStyleName Property

Gets name of the IStyle object that represents style of the Range.
Syntax
'Declaration
 
Property CellStyleName As String
'Usage
 
Dim instance As IRange
Dim value As String
 
instance.CellStyleName = value
 
value = instance.CellStyleName
string CellStyleName {get; set;}
Example
The following code illustrates how to access CellStyleName property of the Range.
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];
            
            //Add style
            IStyle style = workbook.Styles.Add("CustomStyle");
            
            //Set color
            style.ColorIndex = ExcelKnownColors.Red;
            
            //Set style
            worksheet["C2"].CellStyle = style;
            
            //Check Style name
            Console.Write(worksheet["C2"].CellStyleName);
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
            Console.ReadKey();
        }
    }
}
//Output will be
//CustomStyle
AssemblyVersion

Syncfusion.XlsIO.Base: 16.4460.0.40

See Also