Syncfusion.XlsIO.Base
Example 


Syncfusion.XlsIO Namespace > IWorksheet Interface > SetDefaultColumnStyle Method : SetDefaultColumnStyle(Int32,Int32,IStyle) Method
Starting column index.
Ending column index.
Default style.

SetDefaultColumnStyle(Int32,Int32,IStyle) Method

Sets the default column style for the specified starting and ending column.
Syntax
'Declaration
 
Overloads Sub SetDefaultColumnStyle( _
   ByVal iStartColumnIndex As Integer, _
   ByVal iEndColumnIndex As Integer, _
   ByVal defaultStyle As IStyle _
) 
'Usage
 
Dim instance As IWorksheet
Dim iStartColumnIndex As Integer
Dim iEndColumnIndex As Integer
Dim defaultStyle As IStyle
 
instance.SetDefaultColumnStyle(iStartColumnIndex, iEndColumnIndex, defaultStyle)
void SetDefaultColumnStyle( 
   int iStartColumnIndex,
   int iEndColumnIndex,
   IStyle defaultStyle
)

Parameters

iStartColumnIndex
Starting column index.
iEndColumnIndex
Ending column index.
defaultStyle
Default style.
Example
The following code illustrates how to set the default style for columns.
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];
            
            //Create style
            IStyle style = workbook.Styles.Add("CustomStyle");
            
            //Set color
            style.ColorIndex = ExcelKnownColors.Red;
            
            //Set default style
            worksheet.SetDefaultColumnStyle(2, 5, style);
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 16.4460.0.40

See Also