Syncfusion.XlsIO.Base
Example 


CellStyle Property (IRange)

Gets a IStyle object that represents the style of the Range.
Syntax
'Declaration
 
Property CellStyle As IStyle
'Usage
 
Dim instance As IRange
Dim value As IStyle
 
instance.CellStyle = value
 
value = instance.CellStyle
IStyle CellStyle {get; set;}
Remarks
To know more about setting styles refer Set Default Style for row/column.
Example
The following code illustrates how to access IStyle using CellStyle property of the Range.
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];
            
            //Set text
            worksheet["C2"].Text = "Sample";
            
            //Add style
            IStyle style = workbook.Styles.Add("BorderStyle");
            
            //Set color
            style.ColorIndex = ExcelKnownColors.Red;
            
            //Set style
            worksheet["C2"].CellStyle = style;
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.2460.0.34

See Also