Я хочу, чтобы при записи данных в Excel из базы данных после 1000 строк данные автоматически переходили на следующий лист. Как мы напишем код (логику) в java
List<String> header = new ArrayList<String>();
header.add("EmployeeId");
header.add("EmployeeEmailId");
header.add("EmployeeAddress");
header.add("EmployeePhonenumber");
header.add("EmployeePincode");
int horizCount = 0;
int verticalCount = 0;
for ( String head : header ) {
workSheet.addCell(new Label(verticalCount++,horizCount,head,headerFormat));
}
horizCount = 1 ;
for( Employee employee: uniqueStrings ){
verticalCount = 0;
workSheet.addCell(new Label(verticalCount++,horizCount,employee.getEmployeeId(),dataFormat));`enter code here`
workSheet.addCell(new Label(verticalCount++,horizCount,employee.getEmployeeEmailId(),dataFormat));
workSheet.addCell(new Label(verticalCount++,horizCount,employee.getEmployeeadddress(),dataFormat));
workSheet.addCell(new Label(verticalCount++,horizCount,employee.getEmployeephoneno(),dataFormat));
workSheet.addCell(new Label(verticalCount++,horizCount,employee.getEmployeepincode(),dataFormat));
horizCount++;
}
//write to the excel sheet
workbook.write();
//close the workbook
workbook.close();
}
catch(FileNotFoundException e)
{
workbook.write();
//close the workbook
workbook.close();
throw new IOException("File Not found exception occured.");
}