autoFitRows method
void
autoFitRows()
Changes the height of the rows in the Range to achieve the best fit.
Workbook workbook = new Workbook();
Worksheet sheet = workbook.worksheets[0];
//Auto-fit columns
Range range = sheet.getRangeByName('A1:D4');
range.autofitRows();
List<int> bytes = workbook.saveAsStream();
File('AutoFitRows.xlsx').writeAsBytes(bytes);
workbook.dispose();
Implementation
void autoFitRows() {
for (int i = row; i <= lastRow; i++) {
_worksheet.autoFitToRow(i, column, lastColumn);
}
}