i have like this problem with poi and excel 2003 :

i laod my excel file with httpresponse and, my file lose the format, i got a
message where  the Ms Excel informe me that this file is endomaged. but the
file is opened with MsExcel 2000 and openOffice.

there is my code : 

        String fs = System.getProperty("file.separator");
        
        POIFSFileSystem fs1 = new POIFSFileSystem(new FileInputStream(
                ServletActionContext.getServletContext().getRealPath("") + fs + 
"template"
+ fs + "G-Chiffrage-M_Graphtalk AIA_NumDemande_v1.1.xls"));
        HSSFWorkbook wb1 = new HSSFWorkbook(fs1, true); 


HttpServletResponse pResponse =  ServletActionContext.getResponse();
        pResponse.setContentType("application/vnd.ms-excel");
        pResponse.setHeader("Content-Disposition", "attachment;
filename=outout.xls");

        OutputStream lOutput = pResponse.getOutputStream();
        wb1.write(lOutput);

        lOutput.close();

any idea.

thanks a lot.

hicham


Nick Burch wrote:
> 
> On Wed, 7 Jan 2009, Patrick GUERIN wrote:
>> But, unfortunaly, files created or modified with Excel 2003 can't be used 
>> with apache POI.
>>
>> It work fine with files created by OpenOffice or older version of Excel.
>>
>> This exception thrown:
>> java.lang.IllegalArgumentException: Your InputStream was neither an OLE2 
>> stream, nor an OOXML stream
> 
> I'd check that your file really is an excel .xls file. You get that 
> exception if you try to feed POI something that isn't really a .xls or 
> .xlsx, for example a csv file, or html (both of which excel will happily 
> open when named .xls)
> 
> Nick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Can%27t-read-excel-2003-xls-file-tp21328806p21739287.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