i m not able to resolve this problem my code is this 
BufferedReader br = req.getReader();
                        
int ch;
while ((ch = br.read()) != -1 )
{
sbOrigEng1.append((char)ch);
}
substr = sbOrigEng1.toString();
br.close();
System.out.println("sbOrig    "+ sbOrigEng1);
String FileContaind = null;
String tempstr = new String();
index = substr.indexOf("Content-Type:");
tempstr = sbOrigEng1.substring(0,index);
index = tempstr.lastIndexOf("\\");
FileName = tempstr.substring(index+1,tempstr.length()-3); 
filesize = sbOrigEng1.length();
index = sbOrigEng1.indexOf("vnd.ms-excel");
FileContaind = sbOrigEng1.substring(index+12,filesize);
index = FileContaind.indexOf("-------------------");
FileContaind = FileContaind.substring(3,index-1);
ByteArrayInputStream Bis1 = new
ByteArrayInputStream(FileContaind.getBytes("UTF-8"));
POIFSFileSystem fs      =  new POIFSFileSystem(Bis1);
            HSSFWorkbook wb = new HSSFWorkbook(fs);


it throws an exception invalid header signature
            



Nick Burch wrote:
> 
> On Tue, 22 Jan 2008, teena21 wrote:
>> i am uploading an excel file using servlet.  i use POIFS for this but 
>> when i read this it gives an exception java.io.IOException: Invalid 
>> header signature; read -6862622098023464182, expected 
>> -2226271756974174256
> 
> That means the inputstream you passed in was not a valid ole2 document 
> stream
> 
>> i get the input stream and i had extract header and tailer from that 
>> stream and pass anly excel data as an input toPOIFSFileSystem it throws 
>> an exception how can i resolve it
> 
> I'd suggest writing the file out to disk from your servlet, and try 
> loading that into poi/excel. Once you have that working, your servlet code 
> ought to be processing the input streams properly, and you can pass on to 
> poi as normal. Until then, there'll be something wrong with your servlet
> 
> It's probably worth checking the list archives, lots of people have posted 
> working servlets for working with excel files over the years
> 
> Nick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 




-- 
View this message in context: 
http://www.nabble.com/java.io.IOException%3A-Invalid-header-signature-tp15016023p15016856.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]

Reply via email to