Search in sources :

Example 1 with ExcelWriteFillExecutor

use of com.alibaba.excel.write.executor.ExcelWriteFillExecutor in project easyexcel by alibaba.

the class ExcelBuilderImpl method fill.

@Override
public void fill(Object data, FillConfig fillConfig, WriteSheet writeSheet) {
    try {
        if (context.writeWorkbookHolder().getTempTemplateInputStream() == null) {
            throw new ExcelGenerateException("Calling the 'fill' method must use a template.");
        }
        if (context.writeWorkbookHolder().getExcelType() == ExcelTypeEnum.CSV) {
            throw new ExcelGenerateException("csv does not support filling data.");
        }
        context.currentSheet(writeSheet, WriteTypeEnum.FILL);
        if (excelWriteFillExecutor == null) {
            excelWriteFillExecutor = new ExcelWriteFillExecutor(context);
        }
        excelWriteFillExecutor.fill(data, fillConfig);
    } catch (RuntimeException e) {
        finishOnException();
        throw e;
    } catch (Throwable e) {
        finishOnException();
        throw new ExcelGenerateException(e);
    }
}
Also used : ExcelWriteFillExecutor(com.alibaba.excel.write.executor.ExcelWriteFillExecutor) ExcelGenerateException(com.alibaba.excel.exception.ExcelGenerateException)

Aggregations

ExcelGenerateException (com.alibaba.excel.exception.ExcelGenerateException)1 ExcelWriteFillExecutor (com.alibaba.excel.write.executor.ExcelWriteFillExecutor)1