Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么使用HSSFWorkBook读 #4075

Open
yuf19-2022 opened this issue Jan 13, 2025 · 0 comments
Open

怎么使用HSSFWorkBook读 #4075

yuf19-2022 opened this issue Jan 13, 2025 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@yuf19-2022
Copy link

yuf19-2022 commented Jan 13, 2025

默认读是用XSSFWorkBook吗,怎么改成HSSFWorkBook
异常:The supplied data appears to be in the OLE2 Format. You are calling the part of POI that deals with OOXML (Office Open XML) Documents.You need to call a different part of POI to process this data (eg HSSF instead of XSSF)
// 写法1:JDK8+ ,不用额外写一个DemoDataListener
// since: 3.0.0-beta1
String fileName = TestFileUtil.getPath() + "demo" + File.separator + "demo.xlsx";
// 这里默认每次会读取100条数据 然后返回过来 直接调用使用数据就行
// 具体需要返回多少行可以在PageReadListener的构造函数设置
EasyExcel.read(fileName, DemoData.class, new PageReadListener(dataList -> {
for (DemoData demoData : dataList) {
log.info("读取到一条数据{}", JSON.toJSONString(demoData));
}
})).sheet().doRead();

@yuf19-2022 yuf19-2022 added the help wanted Extra attention is needed label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant