jxl.write.biff.RowsExceededException: The maximum number of rows permitted on a worksheet been exceeded
解决方法:
int i=0;
int maxRowCount=60000;//不能够超过excel的最大容量
String [] array = new String[8];//用于存储每一行的结果
WritableSheet sheet =book.createSheet("第"+m+"页", m);
while((tempString =reader.readLine())!=null){
if(0!=i && i % maxRowCount == 0)
{
m++;
sheet= book.createSheet("第"+m+"页",m);
i=0;
}
sheet = book.getSheet(m);
sheet.setColumnView(0, 8); // 第1列
sheet.setColumnView(1, 15); // 第2列
sheet.setColumnView(2, 25);
sheet.setColumnView(3, 15);
sheet.setColumnView(4, 28);
sheet.setColumnView(5, 12);
sheet.setColumnView(6, 28);
System.out.println(tempString);
String []str=tempString.split("----");
array[0]=str[2];
System.out.println(array[0]);
array[1]=str[1];
array[2]=str[3];
array[3]=str[4];
array[4]=str[0];
array[5]=str[5];
array[6]=str[6];
for(int j=0;j<array.length;j++){
//在Label对象的构造子中指明单元格的位置是第j列第i行(i,j)以及单元格内容为Str[j]
if(i==0){
sheet.addCell(new Label(0, 0, "姓名"));
sheet.addCell(new Label(1, 0, "性别"));
sheet.addCell(new Label(2, 0, "身份证号码"));
sheet.addCell(new Label(3, 0, "出生日"));
sheet.addCell(new Label(4, 0, "邮箱" ));
sheet.addCell(new Label(5, 0, "手机号"));
sheet.addCell(new Label(6, 0, "邮箱"));
}
Label label =new Label(j,i,array[j]);
//将定义好的单元格添加到工作表中
// System.out.println(label);
sheet.addCell(label);
}
i++;
}