Syncfusion.XlsIO.Base
Example 


One-based column index.

GetColumnWidth Method

Returns the width of the specified column.
Syntax
'Declaration
 
Function GetColumnWidth( _
   ByVal iColumnIndex As Integer _
) As Double
'Usage
 
Dim instance As IWorksheet
Dim iColumnIndex As Integer
Dim value As Double
 
value = instance.GetColumnWidth(iColumnIndex)
double GetColumnWidth( 
   int iColumnIndex
)

Parameters

iColumnIndex
One-based column index.

Return Value

Width of the specified column.
Example
The following code illustrates how to get the column width for a particular column.
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["A1"].Text = "Sample text in cell";
            
            //Set auto fit
            worksheet.AutofitColumn(1);
            
            //Get column width
            Console.WriteLine(worksheet.GetColumnWidth(1));
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
            Console.ReadKey();
        }
    }
}
//Output will be
//17.70701325
AssemblyVersion

Syncfusion.XlsIO.Base: 16.4460.0.40

See Also