Click or drag to resize

XlsWorksheet GetColumnWidthPixels Method

Gets the width of the specified column, in units of pixel.
Examples
The following code illustrates how to get the column width for a particular column:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["A1"].Text = "Sample text in cell";</para><para>//Set auto fit</para><para>worksheet.AutoFitColumn(1);</para><para>//Get column width</para><para>Console.WriteLine(worksheet.GetColumnWidthPixels(1));</para><para>//Save to file</para><para>workbook.SaveToFile("UsedRange.xlsx");</para>

Namespace: Spire.Xls.Core.Spreadsheet
Assembly: Spire.XLS (in Spire.XLS.dll) Version: 15.4.0.0 (15.4.0.5046)
Syntax
public int GetColumnWidthPixels(
	int columnIndex
)

Parameters

columnIndex
Type: System Int32
Column index.

Return Value

Type: Int32
Width of column

Implements

IWorksheet GetColumnWidthPixels(Int32)
See Also