1

HI I am new comer java developer of OLE Object of Package Part. i am facing issue about to read embedded zip from docx file in my current project. I have read docx file and get package part to read embedded object . it returns PackagePart class.

We need to read a zip file which has some excel files. I am confuse that how to read it to get data from excel files.

i am using some code to do this.: -

PackagePart pPart = null;
         Iterator<PackagePart> pIter = null;
         List<PackagePart> embeddedDocs = document.getAllEmbedds();
         if (embeddedDocs != null && !embeddedDocs.isEmpty()) 
         {
             pIter = embeddedDocs.iterator();
             while (pIter.hasNext()) 
             {
                 pPart = pIter.next();
                //System.out.println(pPart.getPartName().getExtension());


                 System.out.println(pPart.getInputStream());


             }
         }

    }
    catch (Exception e)
    {
        e.printStackTrace();
    }

This code provides us some output like

java.io.ByteArrayInputStream@2862c542
java.io.ByteArrayInputStream@6c8484c4
java.io.ByteArrayInputStream@70289784
java.io.ByteArrayInputStream@78f394a2

It is possible that we can read data from attached zip in docx file ?
can we save all data from zip to my hard disk ?

Please help me Thanks to interest.

user1574116
  • 31
  • 1
  • 3

0 Answers0