saveAsStream method

List<int> saveAsStream()

Saves workbook as stream.

Workbook workbook = new Workbook();
Worksheet sheet = workbook.worksheets[0];
List<int> bytes = workbook.saveAsStream();
File('ExcelSave.xlsx').writeAsBytes(bytes);
workbook.dispose();

Implementation

List<int> saveAsStream() {
  _saving = true;
  final SerializeWorkbook serializer = SerializeWorkbook(this);
  serializer._saveInternal();
  final List<int>? bytes = ZipEncoder().encode(archive);
  _saving = false;
  return bytes!;
}