mirror of
https://gitee.com/dromara/hutool.git
synced 2026-02-09 09:16:26 +08:00
add test
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.hutool.v7.poi.excel.reader;
|
||||
package cn.hutool.v7.poi.excel.sax;
|
||||
|
||||
import cn.hutool.v7.core.collection.CollUtil;
|
||||
import cn.hutool.v7.core.collection.ListUtil;
|
||||
@@ -25,8 +25,6 @@ import cn.hutool.v7.core.lang.Console;
|
||||
import cn.hutool.v7.core.text.StrUtil;
|
||||
import cn.hutool.v7.poi.excel.ExcelUtil;
|
||||
import cn.hutool.v7.poi.excel.cell.values.FormulaCellValue;
|
||||
import cn.hutool.v7.poi.excel.sax.Excel03SaxReader;
|
||||
import cn.hutool.v7.poi.excel.sax.StopReadException;
|
||||
import cn.hutool.v7.poi.excel.sax.handler.RowHandler;
|
||||
import cn.hutool.v7.poi.POIException;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.hutool.v7.poi.excel.sax;
|
||||
|
||||
import cn.hutool.v7.core.lang.Console;
|
||||
import cn.hutool.v7.poi.excel.ExcelUtil;
|
||||
import cn.hutool.v7.poi.excel.cell.values.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 final FormulaCellValue result) {
|
||||
Console.log("公式 {} 结果: {}", result.getValue(), result.getResult());
|
||||
}else{
|
||||
Console.log("非公式: {}", value.getClass());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
BIN
hutool-poi/src/test/resources/formula_test.xlsx
Normal file
BIN
hutool-poi/src/test/resources/formula_test.xlsx
Normal file
Binary file not shown.
Reference in New Issue
Block a user