Excel 2003 can only have 255 worksheets in a workbook - the limit goes away with later verions
On Wed, Jul 27, 2011 at 8:34 PM, felixesanchez <[email protected]> wrote: > I having the same problem with POI 3.6. Does anybody know how can I pass this > problem? > > thanks, > > Felix Sanchez > [email protected] > > > java_lee wrote: >> >> Dear All >> >> I use the lastest version of POI(3.1) to create 1400 sheets in a >> workbook. And when I open the XLS file generated by the programe, the MS >> excel 2003 pops the error like bellow. >> >> "Damage to the file was so extensive that repairs were not possible. >> Excel >> attempted to recover your formulas and values, but some data may have been >> lost or corrupted." >> >> code : >> >> import java.io.File; >> import java.io.FileNotFoundException; >> import java.io.FileOutputStream; >> import java.io.FileWriter; >> import java.io.IOException; >> import java.io.OutputStream; >> >> import org.apache.poi.hssf.usermodel.HSSFSheet; >> import org.apache.poi.hssf.usermodel.HSSFWorkbook; >> >> >> >> public class Test { >> >> public static void main(String[] args) { >> FileOutputStream fs = null; >> try { >> fs = new FileOutputStream("test.xls"); >> } catch (FileNotFoundException e) { >> e.printStackTrace(); >> } >> >> HSSFWorkbook wb = new HSSFWorkbook(); >> String sheetName = "s"; >> >> for(int i=0;i<2000;i++){ >> sheetName = sheetName + i; >> wb.createSheet(sheetName); >> sheetName = "s"; >> >> System.out.println("sheet of number " + i + >> "finish!!!"); >> >> } >> >> try { >> wb.write(fs); >> fs.close(); >> } catch (IOException e) { >> e.printStackTrace(); >> } >> >> System.out.println("finish!!"); >> >> } >> } >> >> >> And if the number of sheet is under 1370 or open it with EIOffice(a >> office programe like ms office) even it more than 1400 sheets, it can be >> opened normally. Can anyone of you tell me why? >> >> Thanks in advance for your help! >> Andy >> > > > -- > View this message in context: > http://apache-poi.1045710.n5.nabble.com/the-maximum-number-of-sheets-can-create-in-one-workbook-tp2299700p4640053.html > Sent from the POI - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
