GemBox.Spreadsheet

ExcelColumn.AutoFit Method 

Automatically fits column width to the minimum size required for all data in the column to be visible.

public void AutoFit();

Remarks

Auto-fit column width is a MS Excel feature and not a XLS file format feature. When columns are auto-fit in MS Excel user interface, MS Excel will calculate current character widths and set column width to the new numeric value.

This method will set Width to the approximate value (maxCharCount * 340).

See Also

ExcelColumn Class | GemBox.Spreadsheet Namespace