autoFitRow method
Changes the height of the specified row to achieve the best fit.
// Create a new Excel Document.
final Workbook workbook = Workbook();
// Accessing sheet via index.
final Worksheet sheet = workbook.worksheets[0];
final Range range1 = sheet.getRangeByName('A1');
range1.setText('WrapTextWrapTextWrapTextWrapText');
final CellStyle style = workbook.styles.add('Style1');
style.wrapText = true;
range1.cellStyle = style;
//Auto Fit Row
sheet.autoFitRow(1);
// save and dispose.
final List<int> bytes = workbook.saveAsStream();
saveAsExcel(bytes, 'AutoFitRow.xlsx');
workbook.dispose();
Implementation
void autoFitRow(int rowIndex) {
final int iFirstColumn = getFirstColumn();
final int iLastColumn = getLastColumn();
autoFitToRow(rowIndex, iFirstColumn, iLastColumn);
}