This commit is contained in:
Looly 2022-04-02 00:19:38 +08:00
parent d78b14c5d4
commit be96b8c8b3
3 changed files with 22 additions and 6 deletions

View File

@ -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方法

View File

@ -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;
}
/**

View File

@ -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);
}
}