showRows method

void showRows(
  1. bool? isVisible
)

Shows or hides rows in the given range. TRUE by default.

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

Implementation

void showRows(bool? isVisible) {
  if (isSingleRange) {
    Row? row1 = _worksheet.rows[row];
    if (row1 == null) {
      row1 = Row(_worksheet);
      row1.index = row;
      worksheet.rows[row] = row1;
    }
    row1.isHidden = !isVisible!;
  } else {
    for (int rowIndex = row; rowIndex <= lastRow; rowIndex++) {
      Row? row1 = _worksheet.rows[rowIndex];
      if (row1 == null) {
        row1 = Row(_worksheet);
        row1.index = rowIndex;
        worksheet.rows[rowIndex] = row1;
      }
      row1.isHidden = !isVisible!;
    }
  }
}