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

excel is corrupted content in web dynpro java 7.4

Hi everyone,

I used fileupload in web dynpro for java 7.4, i'm facing an issue "corrupted content" when upload an excel file to server.

resouce type:

My code :


IPrivateMyCompView.IContextElement element = wdContext.currentContextElement();


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 =!=-1){





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());




}catch (FileNotFoundException e){

wdComponentAPI.getMessageManager().reportException("FileNotFoundException: "+e.getMessage());


}catch (IOException e){

wdComponentAPI.getMessageManager().reportException("IOException: "+e.getMessage());



Please help me

Thanks & Best Regard,


Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Aug 10, 2016 at 09:51 AM

    Hi hhoang,

    did you compare the two files yet (the original and the uploaded one from the server)?

    Maybe you can see the difference there or the point where the "corruption" starts.

    Regards Stefan

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 11, 2016 at 02:25 AM

    Workbook wb = Workbook.getWorkbook(new File(path));

    create wb from stream directly, no need to save to disk....

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member


      i get stream directly as below

      Workbook wb = Workbook.getWorkbook(wdContext.currentContextElement().getMy_Resource().read(false));

      it's still error, think there is something wrong when return wdContext.currentContextElement().getMy_Resource().read(false) . maybe SC of NWDS cause this issue ? I'm using SAP NetWeaver Developer Studio 7.3 SP18 PAT0002


  • Posted on Aug 11, 2016 at 10:21 AM

    may i ask why you've opened a new thread (previous thread /)?

    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.