package com.qmth.boot.tools.excel.writer;

import com.qmth.boot.tools.excel.ExcelWriter;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;

import java.io.IOException;
import java.io.OutputStream;

public class XlsxWriter extends ExcelWriter {

    private SXSSFWorkbook workbook;

    public XlsxWriter() {
        this.workbook = new SXSSFWorkbook(100);
    }

    @Override
    public Workbook getWorkbook() {
        return workbook;
    }

    @Override
    public void output(OutputStream ous) throws IOException {
        super.output(ous);
        workbook.dispose();
    }
}
