on 07-12-2016 10:13 AM
Hi everybody,
I used jxl to upload *.xls file in web dynpro for java 7.4, i'm facing an issue "BiffException: jxl.read.biff.BiffException: Unable to recognize OLE stream"
My code as below:
resouce type: com.sap.ide.webdynpro.uielementdefinitions.Resource
try{
IPrivateMyCompView.IContextElement element = wdContext.currentContextElement();
if(element.getMyResource()!=null){
InputStream in = null;
int temp = 0;
File file = new File(wdContext.currentContextElement().getMyResource().getResourceName());
FileOutputStream out = new FileOutputStream(file);
in = element.getMyResource().read(false);
while((temp = in.read())!=-1){
out.write(temp);
}
out.flush();
out.close();
path = file.getAbsolutePath();
wdComponentAPI.getMessageManager().reportSuccess("path: "+path);
// path = usr/sap/DEP/J00/j2ee/cluster/server0/Book1.xls
try {
Workbook wb = Workbook.getWorkbook(new File(path));
} catch (BiffException e) {
wdComponentAPI.getMessageManager().reportException("BiffException: "+e.getMessage());
e.printStackTrace();
}
}
}catch (FileNotFoundException e){
wdComponentAPI.getMessageManager().reportException("FileNotFoundException: "+e.getMessage());
e.printStackTrace();
}catch (IOException e){
wdComponentAPI.getMessageManager().reportException("IOException: "+e.getMessage());
e.printStackTrace();
}
Thanks & Best Regard,
hhoang
Hi,
I'm quite sure this is not a web dynpro but a jxls issue. are you sure that the uploaded excel is a .xls (saved as 97-2003) format and not a .xlsx as .xls (saved as 2010)format?
regards,
Christian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i see.
i remember we had a similar issue with uploaded documents where the uploaded file got corrupted. which SP is your netweaver system on? - check the sap note http://service.sap.com/sap/support/notes/2297508
regards,
christian
i use POI to read excel file and exception:
InvalidFormatException: Your InputStream was neither an OLE2 stream, nor an OOXML stream |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check this code for help you.
otherwise try this logic
InputStream inputStream = getFile_Resource().read(false);//IWDResource
Workbook workbook = Workbook.getWorkbook(inputStream);
Regards,
Durga Rao./message-abuse!input.jspa?objectID=16834416&objectType=2
hmm that's odd. i've just tried it (http://service.sap.com/sap/support/notes/2297508) and for me it works
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.