Bug 13265 - Could not generate Excel File. Having all ASCII characters.
Summary: Could not generate Excel File. Having all ASCII characters.
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 1.5.1
Hardware: PC All
: P3 critical with 4 votes (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2002-10-03 23:45 UTC by Srinivas Sunkara
Modified: 2006-08-11 08:34 UTC (History)
1 user (show)

POI sample code that don't works (2.49 KB, text/plain)
2002-10-04 12:28 UTC, FERRE Julien
Sample of what is generated (5.50 KB, application/xls)
2002-10-04 12:30 UTC, FERRE Julien

Note You need to log in before you can comment on or make changes to this bug.
Description Srinivas Sunkara 2002-10-03 23:45:43 UTC

I am using POI 1.5 released version to create excel files and for some reason I 
couldn't create them on Windows NT 4.0, WebSphere Application Server 3.5 and 
JDK 1.2.2.

I am trying to create an excel file with 3 sheets in it and some colors and 
content. I don't see any exception or error when I am trying to create the 
file. However when I look at the created file, I see only ASCII characters in 
an unreadable format. All three sheets were combined in to one sheet with 
default file name as sheet name.

Could some one explain me why and how to fix this.

Thanks for all your help and attention,
Comment 1 FERRE Julien 2002-10-04 08:50:04 UTC
I have the same problem with a Windows 2000 and WAS 3.5.3. I use Visual Ages 
for java for developpement and have no problem with the XLS files I generate, 
so I guess it must come form the WAS's JVM.
Comment 2 Andy Oliver 2002-10-04 12:10:54 UTC
For starts please ensure you're using 1.5.1 and not 1.5.  Secondly, in reporting
bugs we need the minimum simplest code necessary to reproduce the bug as well as
the result (sheet).  (Click create a new attachment)..  Otherwise I can only
guess whats wrong.

Comment 3 FERRE Julien 2002-10-04 12:28:48 UTC
Created attachment 3346 [details]
POI sample code that don't works
Comment 4 FERRE Julien 2002-10-04 12:30:39 UTC
Created attachment 3347 [details]
Sample of what is generated
Comment 5 FERRE Julien 2002-10-04 12:31:21 UTC
We use POI 1.5.1
Here is the code sample we use to create the XLS file. 
I didn't have time to isolate the POI code inside our main code and the 
developper didn't take time to make a component to use POI API (grrrr :()

We don't do make very complicated things.
I also attach the result of this code.
thanks for help

Comment 6 Andy Oliver 2002-10-04 13:48:20 UTC
Okay...from this the best I can say is your code looks fine overall.  Nothing
jumps out at me.  (Since I can't run it this doesn't mean much).  However the
file has crap in the header.  I ran org.apache.poi.hssf.dev.BiffViewer on it and
even the first few bytes are garbled.  It looks as if some other garbage got
written to the top of the file.  I opened it in vi and the header has some
strange things in it that I would not expect to see:


This is the header from a healthy file:

 ^H^P^@^@^F^E^@¯^XÍ^GÁ@^@^@^F^A^@^@á^@^B^@°^DÁ^@^B^@^@^@â^@^@^@\^@p^@^D^@^@nameas Wegmueller                                                                                            B

Granted this is a goofy check since its binary and I'm opening it with a text
editor, however if you look at the first few characters its always the same.  

I'm closing this as a bug as it doesn't seem to be a bug in POI rather some
quirkiness in WS.  Repost to the poi-users list and see if any websphere folks
there can help you.  I know someone had a similar problem awhile back that they
were able to resolve.  I'd also like to make the suggestion that if you'd like
to fix this you're going to have to invest the time to do the legwork as no one
is going to do the dirty work for you for free (even if they can) just because
you "don't have time".  My attitude is generally "I'm willing to help
(especially if it helps the project as a whole), but you have to commit to doing
the bulk of the work."

Comment 7 FERRE Julien 2002-10-04 13:56:54 UTC
Thanks. I didn't want anyone to do the dirty job. it just appears that when we 
are deploying the applicaiton under websphere the files are not correct nay 
more whereas they are under VAJ. SO I was wondering if anyone has the same 
problem. I saw that bug on the bug list and tought it was the same. 
I was wondering if anyone had alreayd solved the problem or at least I wanted 
to know if it was unsolvable. 
i didn't have the time mean it appears realyl soon and right now I didn't have 
the time as I had a release to prepare quite fast so I didn't have to make a 
clear test. i aslo did not try to take that time as someone had the same 
I will follow your adivse and go to user list.
thanks for the time you take. and sorry to get you into on nervse. i use to 
make the dirty job here so i undertsand you very well
Comment 8 Srinivas Sunkara 2002-10-04 14:52:00 UTC
Thanks a bunch to Ferre and Andy for your attention. I didn't mean that this is 
bug in POI and some one has to fix it. I thought may be I could find some one 
else who is experiencing the similar problem and could help me with that. 
Again, I don't expect others to do the dirty job for me (which doesn't make any 

Given that this could be an issue with WAS (I assume) I'll see if I can find 
any solution to this.

Ferre, could you let us know if you find any on this.

Thanks again to both of you for your time and attention in this.
Comment 9 Andy Oliver 2002-10-04 18:23:28 UTC
cool.  For future reference.  the most appropriate place to ask for help is on
the poi-user mail list.  Bugzilla is for bugs and patches.  Thanks.
Comment 10 Srinivas Sunkara 2002-10-07 14:17:45 UTC
I installed Fix Pack 4 on WAS 3.5 and it did fix the problem. (Before I had Fix 
Pack 2.) Hope this helps !
Comment 11 Viral Patel 2006-08-11 15:34:34 UTC
(In reply to comment #4)
> Created an attachment (id=3347) [edit]
> Sample of what is generated

I came across the same problem and found that response buffer needs to be 
cleared before writing HSSF output to the console.

This problem seems to be only with BEA Weblogic and the code works fine with 
other servers. The sample code is attached below.

	OutputStream fOut = response.getOutputStream();
}catch(Exception e){
	System.out.println("Error Occured");

Hope that helps.
Viral Patel