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!;
}