You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by sarmahdi <sa...@hotmail.com> on 2012/01/21 17:18:36 UTC

exception on HSSFWorkbook creation

hi all,


Im trying to post into an excel file sets of four strings. for 10, 12
records it works fine but after that it gives this exception below. I
searched on the net and updated my POI jar to latest stable release but the
problem is still there.. 

the code looks like this :
	/private static HSSFWorkbook readFile(String filename) throws IOException {
		HSSFWorkbook wbook = null;
		
			try {
				FileInputStream is= new FileInputStream(filename);
				wbook = new HSSFWorkbook(is);
				is.close();
			} catch (RuntimeException e) {
				
				e.printStackTrace();
			}
		
		return wbook;
	}/

the exception is thrown on the line wbook = new HSSFWorkbook(is); . 

[1/21/12 18:16:55:033 AST] 00000029 SystemErr     R
*org.apache.poi.hssf.record.RecordInputStream$Lef
toverDataException: Initialisation of record 0x3C left 5414 bytes remaining
still to be read.
[1/21/12 18:16:55:048 AST] 00000029 SystemErr     R 	at
org.apache.poi.hssf.record.RecordInputStream*
.hasNextRecord(RecordInputStream.java:156)
[1/21/12 18:16:55:048 AST] 00000029 SystemErr     R 	at
org.apache.poi.hssf.record.RecordFactoryInpu
tStream.nextRecord(RecordFactoryInputStream.java:216)
[1/21/12 18:16:55:048 AST] 00000029 SystemErr     R 	at
org.apache.poi.hssf.record.RecordFactory.cre
ateRecords(RecordFactory.java:442)
[1/21/12 18:16:55:048 AST] 00000029 SystemErr     R 	at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<
init>(HSSFWorkbook.java:263)
[1/21/12 18:16:55:048 AST] 00000029 SystemErr     R 	at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<
init>(HSSFWorkbook.java:188)
[1/21/12 18:16:55:048 AST] 00000029 SystemErr     R 	at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<
init>(HSSFWorkbook.java:305)
[1/21/12 18:16:55:048 AST] 00000029 SystemErr     R 	at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<
init>(HSSFWorkbook.java:286)
[1/21/12 18:16:55:048 AST] 00000029 SystemErr     R 	at
com.ejada.dac.xmlparser.ExcelSheetWriter.rea
dFile(ExcelSheetWriter.java:156)
[1/21/12 18:16:55:048 AST] 00000029 SystemErr     R 	at
com.ejada.dac.xmlparser.ExcelSheetWriter.wri
teExcelFile(ExcelSheetWriter.java:100)




I will appreciate if any one can give me a hint as to what I should do to
resolve this. 

When I try to open the xls file that has been created MS Excel says : Excel
Found unreadable content in 'myexcel.xls'. Do you want to  recover the
contents of this workbook? if you click the source of thyis workbook click
yes.  whne i click yes it gives a small box saying : "Repairs to
'myexcel.xls' :Excel recovered your formulas and cell values, but some data
may have been lost.

Thanks in advance.

Syed.

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/exception-on-HSSFWorkbook-creation-tp5162898p5162898.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: exception on HSSFWorkbook creation

Posted by Nick Burch <ni...@alfresco.com>.
On Sat, 21 Jan 2012, sarmahdi wrote:
> I will appreciate if any one can give me a hint as to what I should do 
> to resolve this.

Have you tried with the most recent POI beta release? It could well be 
fixed in a newer version

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: exception on HSSFWorkbook creation

Posted by sarmahdi <sa...@hotmail.com>.
Just to add an answer: 

the problem was that on the 12 or 13th insert the record that would come
would be some how too big for excel to digest. usually if the cell value is
greater than 32,000 chars it will throw the exception that value is too big
but in this case it didnt, may be that was not the issue. but what i did was
i wrote each insert into its own respective file and i got all the responses
and even this one too, but the file was too big while the rest of my files
were like under 100 KB this one was more than 300 KB so something huge was
in there and the file didnt even open right. and showed me an empty file
even tho the size was 300 KB. so when this data was inserted to the excel
file may be POI didnt manage to write it completely and thats why it said
that so much so bytes still needed to be written. hence the next inserts
failed after that.

So i just have to see what is in the data thats causing this. other wise
this is solved.

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/exception-on-HSSFWorkbook-creation-tp5162898p5163763.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org