Replies: 2 comments
-
|
在文件大小可控的情况下,可以通过 Apache POI 的 API 预先获取行数,例如: try (XSSFWorkbook workbook = new XSSFWorkbook(PATHNAME)) {
XSSFSheet sheet = workbook.getSheetAt(0);
int totalRows = sheet.getLastRowNum() + 1;
log.info("Total rows = {}", totalRows);
}不过,如果行数仅用于前端进度条渲染,而并非业务上的强依赖项,那么也可以考虑使用 “伪进度条” 的方式处理: ↓ Web 端提交任务 这种方式在多数场景下基本能够兼顾用户体验,同时避免为了获取行数而提前读取整个文件。 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
see https://fesod.apache.org/docs/sheet/help/faq/#get-total-rows |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
在监听器里,只能所有行都处理完,才能读到所有行数吗?但是前端要做进度条。
Beta Was this translation helpful? Give feedback.
All reactions