This commit is contained in:
Looly
2020-02-29 12:37:15 +08:00
parent 623d5ef5c9
commit df96ef1a29

View File

@@ -117,10 +117,7 @@ public class ExcelBase<T extends ExcelBase<T>> implements Closeable {
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public T setSheet(String sheetName) { public T setSheet(String sheetName) {
this.sheet = this.workbook.getSheet(sheetName); WorkbookUtil.getOrCreateSheet(this.workbook, sheetName);
if (null == this.sheet) {
this.sheet = this.workbook.createSheet(sheetName);
}
return (T) this; return (T) this;
} }