Bug 22568 - Files created w. POI 2.02/2.03 crashes excel if rows > 1800
Summary: Files created w. POI 2.02/2.03 crashes excel if rows > 1800
Status: RESOLVED DUPLICATE of bug 15375
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-pre3
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-19 22:35 UTC by vijay_alluri
Modified: 2005-03-20 17:06 UTC (History)
0 users



Attachments
java test file to generate excel (6.35 KB, text/plain)
2003-08-20 22:07 UTC, vijay_alluri
Details
java test file to generate excel (1.39 KB, text/plain)
2003-08-20 22:12 UTC, vijay_alluri
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vijay_alluri 2003-08-19 22:35:04 UTC
Files created w. POI 2.02/3 crashes excel if rows > 1800
Here is the sample code:
Working fine with POI 1.51/1.8

import java.io.* ;
import org.apache.poi.hssf.usermodel.* ;
import org.apache.poi.hssf.util.*;

public class exceltest {


	public static void main(String[] args){
		if(args.length < 2){
			System.out.println("Please pass rows and cols");
			return;
		}
		process_request(Integer.parseInt(args[0]),Integer.parseInt(args
[1])) ;
	}


	public static void process_request(int r, int c)
	{
		System.out.println("Excel Rows:" + r + ", Cols:" + c);

		HSSFWorkbook wb = new HSSFWorkbook() ;
		HSSFSheet sheet = wb.createSheet("ExcelTest") ;

		int col_cnt=0, rw_cnt=0 ;

		col_cnt = c;//Integer.parseInt(request.getParameter
("COLUMN_CNT")) ;
		rw_cnt = r;//Integer.parseInt(request.getParameter("ROW_CNT")) ;

		HSSFRow rw = null ;
		HSSFCell cell =null;




		rw = sheet.createRow((short)0) ;
		//Header row
		for(short j=0; j<col_cnt; j++){
			cell = rw.createCell((short)j) ;
			cell.setCellValue("Col " + (j+1)) ;
		}

		for(int i=1; i<rw_cnt; i++){
			rw = sheet.createRow((short)i) ;
			for(short j=0; j<col_cnt; j++){
				cell = rw.createCell((short)j) ;
				cell.setCellValue("Row:" + (i+1) + ",Column:" + 
(j+1)) ;
			 }
		}

		sheet.setDefaultColumnWidth((short) 18) ;

		System.out.println("Excel Object Created" );

		try
		{
			FileOutputStream out = new FileOutputStream
("test.xls") ;
			wb.write(out) ;

			out.close() ;
			System.out.println("Excel write to File :");
		}
		catch(IOException io_Excp)
		{
			System.out.println(io_Excp.getMessage()) ;
		}
	}

}
Comment 1 vijay_alluri 2003-08-20 22:07:18 UTC
Created attachment 7908 [details]
java test file to generate excel
Comment 2 vijay_alluri 2003-08-20 22:12:27 UTC
Created attachment 7909 [details]
java test file to generate excel
Comment 3 vijay_alluri 2003-08-20 22:17:53 UTC
Ignore 1st attachment (id=7908)
Comment 4 Avik Sengupta 2003-10-06 09:46:55 UTC

*** This bug has been marked as a duplicate of 15375 ***