Click or drag to resize

XlsRange AutoFitRows Method

Changes the width of the height of the rows in the range to achieve the best fit.
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.Spreadsheet
Assembly: Spire.XLS (in Spire.XLS.dll) Version: 15.4.0.0 (15.4.0.5046)
Syntax
public void AutoFitRows()

Implements

IXLSRange AutoFitRows
See Also