fastexcel 是最新的。先创建一个xsl文件,再去读取,结果显示最后一列丢失。但是,当我再次保存XLS文件时,读取时最后一列不是最后一列。
生成代码:java代码
Workbook workBook;
workBook = FastExcel.createWriteableWorkbook(xls);
workBook.open();
int rowsLength = rows.length;
int sheets = rowsLength / sheetRows
+ (rowsLength % sheetRows > 0 ? 1 : 0);
int sheetNumber;
for (int i = 0; i < sheets; i++) {
sheetNumber = i + 1;
Sheet sheet = workBook.addStreamSheet(sheetName + sheetNumber);
// sheet.addRow(titles);
for (int j = i * sheetRows; j < rowsLength; j++) {
sheet.addRow(rows[j]);
if (j >= sheetRows * sheetNumber) {
break;
}
}
}
workBook.close();
通过阅读java代码编写代码
Workbook workBook;
workBook = FastExcel.createReadableWorkbook(xls);
workBook.setSSTType(BIFFSetting.SST_TYPE_DEFAULT);
workBook.open();
Sheet s;
s = workBook.getSheet(0);
excelContent = new String[s.getLastRow()-startRow][];
for (int i = startRow; i < s.getLastRow(); i++) {
excelContent[i-startRow] = s.getRow(i);
}
workBook.close();