public int getNewRowIndexAndStartDoWrite() { // 'getLastRowNum' doesn't matter if it has one or zero,is's zero int newRowIndex = 0; switch (writeLastRowType) { case TEMPLATE_EMPTY: if (parentWriteWorkbookHolder.getExcelType() == ExcelTypeEnum.XLSX) { if (parentWriteWorkbookHolder.getTemplateLastRowMap().containsKey(sheetNo)) { newRowIndex = parentWriteWorkbookHolder.getTemplateLastRowMap().get(sheetNo); } } else { newRowIndex = sheet.getLastRowNum(); }
newRowIndex++;//这里默认加了一行,导至我加入title后前面总是空一行
break;
case HAS_DATA:
newRowIndex = sheet.getLastRowNum();
newRowIndex++;
break;
default:
break;
}
writeLastRowType = WriteLastRowType.HAS_DATA;
return newRowIndex;
}