Click or drag to resize

IWorksheet AutoFitColumn Method

Autofits specified column.
Examples
The following code illustrates how to Auto-fit the 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>//Save to file</para><para>workbook.SaveToFile("AutoFitColumn.xlsx");</para>

Namespace: Spire.Xls.Core
Assembly: Spire.XLS (in Spire.XLS.dll) Version: 15.4.0.0 (15.4.0.5046)
Syntax
void AutoFitColumn(
	int columnIndex
)

Parameters

columnIndex
Type: System Int32
One-based column index.
See Also