fix: 处理 excel 数据

This commit is contained in:
taojinlong 2021-12-01 21:41:59 +08:00
parent bbb5379922
commit 6c9b3882ba

View File

@ -384,9 +384,14 @@ public class ExcelXlsxReader extends DefaultHandler {
String sstIndex = value.toString(); String sstIndex = value.toString();
try { try {
int idx = Integer.parseInt(sstIndex); int idx = Integer.parseInt(sstIndex);
XSSFRichTextString rtss = new XSSFRichTextString(sst.getEntryAt(idx));//根据idx索引值获取内容值 if(sst != null){
thisStr = rtss.toString(); XSSFRichTextString rtss = new XSSFRichTextString(sst.getEntryAt(idx));//根据idx索引值获取内容值
rtss = null; thisStr = rtss.toString();
rtss = null;
}else {
thisStr = value.toString();
}
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
thisStr = value.toString(); thisStr = value.toString();
} }