hutool 解析excel批注
时间: 2023-07-07 09:30:28 浏览: 121
使用Hutool解析Excel批注可以通过以下步骤实现:
1. 使用ExcelReader对象读取Excel文件
```java
ExcelReader reader = ExcelUtil.getReader(FileUtil.file("test.xlsx"));
```
2. 获取Sheet对象
```java
Sheet sheet = reader.getSheet();
```
3. 遍历Sheet中的每一行和每一列,查找批注
```java
// 遍历行
for (int i = sheet.getFirstRowNum(); i <= sheet.getLastRowNum(); i++) {
Row row = sheet.getRow(i);
if (row == null) {
continue;
}
// 遍历列
for (int j = row.getFirstCellNum(); j <= row.getLastCellNum(); j++) {
Cell cell = row.getCell(j);
if (cell == null) {
continue;
}
Comment comment = cell.getCellComment();
if (comment != null) {
System.out.println("批注内容:" + comment.getString().getString());
}
}
}
```
通过以上步骤,就可以使用Hutool解析Excel批注了。
阅读全文
相关推荐

















