Skip to Content
author's profile photo Former Member
Former Member

How to upload *.xls file in web dynpro for java 7.4

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jul 12, 2016 at 09:31 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 13, 2016 at 06:03 AM

    i use POI to read excel file and exception:

    InvalidFormatException: Your InputStream was neither an OLE2 stream, nor an OOXML stream
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.