Syncfusion.XlsIO.Base
Example 


Syncfusion.XlsIO Namespace > IWorksheet Interface > SetColumnWidthInPixels Method : SetColumnWidthInPixels(Int32,Int32,Int32) Method
Start Column index
No of Column to be set width
Value in pixel to set

SetColumnWidthInPixels(Int32,Int32,Int32) Method

Sets column width in pixels to the given number of columns from the specified column index.
Syntax
'Declaration
 
Overloads Sub SetColumnWidthInPixels( _
   ByVal iStartColumnIndex As Integer, _
   ByVal iCount As Integer, _
   ByVal value As Integer _
) 
'Usage
 
Dim instance As IWorksheet
Dim iStartColumnIndex As Integer
Dim iCount As Integer
Dim value As Integer
 
instance.SetColumnWidthInPixels(iStartColumnIndex, iCount, value)
void SetColumnWidthInPixels( 
   int iStartColumnIndex,
   int iCount,
   int value
)

Parameters

iStartColumnIndex
Start Column index
iCount
No of Column to be set width
value
Value in pixel to set
Example
The following code illustrates how to set width 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];
            
            //Set column width
            worksheet.SetColumnWidthInPixels(2, 4, 160);
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 16.4460.0.40

See Also