setNumber method

void setNumber(
  1. double? number
)

Set number value to the range.

Workbook workbook = new Workbook();
Worksheet sheet = workbook.worksheets[0];
Range range = sheet.getRangeByName('A1');
range.setNumber(44);
List<int> bytes = workbook.saveAsStream();
File('Number.xlsx').writeAsBytes(bytes);
workbook.dispose();

Implementation

void setNumber(double? number) {
  if (isSingleRange) {
    _number = number;
    type = CellType.number;
    saveType = 'n';
    _setRange();
  } else {
    // ignore: prefer_final_locals
    for (int iRow = row, iLastRow = lastRow; iRow <= iLastRow; iRow++) {
      // ignore: prefer_final_locals
      for (int iCol = column, iLastCol = lastColumn;
          iCol <= iLastCol;
          iCol++) {
        worksheet.getRangeByIndex(iRow, iCol).number = number;
      }
    }
  }
}