mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:20:07 +08:00
fix code
This commit is contained in:
parent
d78b14c5d4
commit
be96b8c8b3
@ -8,6 +8,7 @@
|
||||
* 【extra 】 【可能兼容问题】BeanCopierCache的key结构变更
|
||||
* 【http 】 【可能兼容问题】HttpInterceptor增加泛型标识,HttpRequest中配置汇总于HttpConfig
|
||||
* 【core 】 【可能兼容问题】UrlQuery.addQuery参数2从String变更为Object
|
||||
* 【core 】 【可能兼容问题】WorkbookUtil.createBook实现改为WorkbookFactory.create
|
||||
|
||||
### 🐣新特性
|
||||
* 【core 】 MapUtil增加entry、ofEntries方法
|
||||
|
@ -159,13 +159,11 @@ public class WorkbookUtil {
|
||||
* @since 4.1.0
|
||||
*/
|
||||
public static Workbook createBook(boolean isXlsx) {
|
||||
Workbook workbook;
|
||||
if (isXlsx) {
|
||||
workbook = new XSSFWorkbook();
|
||||
} else {
|
||||
workbook = new org.apache.poi.hssf.usermodel.HSSFWorkbook();
|
||||
try {
|
||||
return WorkbookFactory.create(isXlsx);
|
||||
} catch (IOException e) {
|
||||
throw new IORuntimeException(e);
|
||||
}
|
||||
return workbook;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,17 @@
|
||||
package cn.hutool.poi.excel;
|
||||
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class WorkbookUtilTest {
|
||||
|
||||
@Test
|
||||
public void createBookTest(){
|
||||
Workbook book = WorkbookUtil.createBook(true);
|
||||
Assert.assertNotNull(book);
|
||||
|
||||
book = WorkbookUtil.createBook(false);
|
||||
Assert.assertNotNull(book);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user