Click or drag to resize

IXLSRange AutoFitRows Method

Autofits all rows in the range.
Examples
The following code illustrates how to auto-size row height to its cell content:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Auto-fit rows</para><para>worksheet.Range["A2"].Text = "Fit the content to row";</para><para>worksheet.Range["A2"].IsWrapText = true;</para><para>worksheet.Range["A2"].AutoFitRows();</para><para>//Save to file</para><para>workbook.SaveToFile("AutoFitRows.xlsx");</para>

Namespace: Spire.Xls.Core
Assembly: Spire.XLS (in Spire.XLS.dll) Version: 15.4.0.0 (15.4.0.5046)
Syntax
void AutoFitRows()
See Also