Commit 83de5382 authored by renjie's avatar renjie

批量添加bug

parent 72bac31d
...@@ -77,17 +77,21 @@ public class FileUtil { ...@@ -77,17 +77,21 @@ public class FileUtil {
inputStream.close(); inputStream.close();
//工作表对象 //工作表对象
Sheet sheet = workbook.getSheetAt(0); Sheet sheet = workbook.getSheetAt(0);
//总行数 //总行数
int rowLength = sheet.getLastRowNum() -1; int rowLength = sheet.getLastRowNum() -1;
log.error(rowLength + "");
log.error(sheet.getLastRowNum() + "");
//工作表的列 //工作表的列
Row row = sheet.getRow(0); Row row = sheet.getRow(0);
//总列数 //总列数
int colLength = row.getLastCellNum(); int colLength = row.getLastCellNum();
log.error(colLength + "!");
//得到指定的单元格 //得到指定的单元格
Cell cell = row.getCell(0);; Cell cell = row.getCell(0);;
int size = 1; int size = 1;
for (int i = 2; i < rowLength; i++) { for (int i = 1; i < rowLength + 2; i++) {
row = sheet.getRow(i); row = sheet.getRow(i);
List<Object> rowvalue = new ArrayList<>(); List<Object> rowvalue = new ArrayList<>();
size = 0; size = 0;
...@@ -96,6 +100,7 @@ public class FileUtil { ...@@ -96,6 +100,7 @@ public class FileUtil {
// System.out.println(cell); // System.out.println(cell);
if (cell!=null) { if (cell!=null) {
Object cellValue = getCellFormatValue(cell); Object cellValue = getCellFormatValue(cell);
log.error(cellValue.toString());
rowvalue.add(cellValue); rowvalue.add(cellValue);
if (StringUtils.isNotBlank(cellValue.toString())) { if (StringUtils.isNotBlank(cellValue.toString())) {
size++; size++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment