From 8cff67dd4696720494cfb44b68952cc0c6b6c39a Mon Sep 17 00:00:00 2001 From: liaochong Date: Sat, 25 May 2024 15:09:14 +0800 Subject: [PATCH] add empty workbook --- .../myexcel/core/DefaultStreamExcelBuilder.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/github/liaochong/myexcel/core/DefaultStreamExcelBuilder.java b/src/main/java/com/github/liaochong/myexcel/core/DefaultStreamExcelBuilder.java index d9a07596..f24be4ee 100644 --- a/src/main/java/com/github/liaochong/myexcel/core/DefaultStreamExcelBuilder.java +++ b/src/main/java/com/github/liaochong/myexcel/core/DefaultStreamExcelBuilder.java @@ -105,6 +105,16 @@ private DefaultStreamExcelBuilder(Class dataType, Path excel) { this.isMapBuild = dataType == Map.class; } + /** + * 创建空的workbook + * + * @return empty workbook + */ + public static Workbook createEmptyWorkbook() { + DefaultStreamExcelBuilder emptyStreamExcelBuilder = DefaultStreamExcelBuilder.of(Cell.class).start(); + return emptyStreamExcelBuilder.build(); + } + /** * 获取实例,设定需要渲染的数据的类类型 *