autoFitToColumn method

void autoFitToColumn(
  1. int firstColumn,
  2. int lastColumn
)

Auto fits the column from specified first to last column.

Implementation

void autoFitToColumn(int firstColumn, int lastColumn) {
  final int iFirstRow = row;
  final int iLastRow = lastRow;
  if (iFirstRow == 0 || iLastRow == 0 || iFirstRow > iLastRow) {
    return;
  }

  if (firstColumn < 1 || firstColumn > workbook.maxColumnCount) {
    throw Exception('firstColumn');
  }

  if (lastColumn < 1 || lastColumn > workbook.maxColumnCount) {
    throw Exception('lastColumn');
  }

  final AutoFitManager autoFitManager =
      AutoFitManager(iFirstRow, firstColumn, iLastRow, lastColumn, this);
  autoFitManager.measureToFitColumn();
}