mirror of
https://gitee.com/dromara/hutool.git
synced 2026-02-09 09:16:26 +08:00
add test
This commit is contained in:
+2
-3
@@ -1,4 +1,4 @@
|
|||||||
package cn.hutool.poi.excel;
|
package cn.hutool.poi.excel.sax;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
@@ -6,9 +6,8 @@ import cn.hutool.core.io.FileUtil;
|
|||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.lang.Console;
|
import cn.hutool.core.lang.Console;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.poi.excel.ExcelUtil;
|
||||||
import cn.hutool.poi.excel.cell.FormulaCellValue;
|
import cn.hutool.poi.excel.cell.FormulaCellValue;
|
||||||
import cn.hutool.poi.excel.sax.Excel03SaxReader;
|
|
||||||
import cn.hutool.poi.excel.sax.StopReadException;
|
|
||||||
import cn.hutool.poi.excel.sax.handler.RowHandler;
|
import cn.hutool.poi.excel.sax.handler.RowHandler;
|
||||||
import cn.hutool.poi.exceptions.POIException;
|
import cn.hutool.poi.exceptions.POIException;
|
||||||
import org.apache.poi.ss.usermodel.CellStyle;
|
import org.apache.poi.ss.usermodel.CellStyle;
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package cn.hutool.poi.excel.sax;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Console;
|
||||||
|
import cn.hutool.poi.excel.ExcelUtil;
|
||||||
|
import cn.hutool.poi.excel.cell.FormulaCellValue;
|
||||||
|
import org.junit.jupiter.api.Disabled;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class Issue4195Test {
|
||||||
|
@Test
|
||||||
|
@Disabled
|
||||||
|
void saxReadFormulaTest() {
|
||||||
|
// 测试公式读取
|
||||||
|
ExcelUtil.readBySax("formula_test.xlsx", -1, (sheetIndex, rowIndex, rowCells) -> {
|
||||||
|
final Object value = rowCells.get(2);
|
||||||
|
if(value instanceof FormulaCellValue) {
|
||||||
|
final FormulaCellValue result = ((FormulaCellValue) value);
|
||||||
|
Console.log("公式 {} 结果: {}", result.getValue(), result.getResult());
|
||||||
|
}else{
|
||||||
|
Console.log("非公式: {}", value.getClass());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Reference in New Issue
Block a user