title: Read DOCx,PPTx,XLSx Files from Android using Apache POI libs - Android
body: <p>I am creating android app that is reading microsoft files without any third party application, I have used Apache POI lib. for reading/Open office files , I am able to open doc,ppt and xls file but not able to open DOCx,PPTx,XLSx , I had tried below code to read </p>
  
  <pre><code>FileInputStream inputStream = new FileInputStream(new File(getIntent().getStringExtra(Constants.FILEPATH)));
          // getResources().getAssets().open("doc2.doc");
  
          XWPFDocument xwpfDocument = new XWPFDocument(inputStream);
  
          xwpfDocument.getXWPFDocument();
          xwpfDocument.getBodyElements();
  </code></pre>
  
  <p>It throws exception as below</p>
  
  <pre><code>04-08 05:34:20.407: E/AndroidRuntime(1222): FATAL EXCEPTION: main
  04-08 05:34:20.407: E/AndroidRuntime(1222): java.lang.ExceptionInInitializerError
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at      org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:154)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at org.apache.poi.openxml4j.opc.OPCPackage.&lt;init&gt;(OPCPackage.java:141)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at org.apache.poi.openxml4j.opc.Package.&lt;init&gt;(Package.java:37)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at org.apache.poi.openxml4j.opc.ZipPackage.&lt;init&gt;(ZipPackage.java:83)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:272)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at org.apache.poi.xwpf.usermodel.XWPFDocument.&lt;init&gt;(XWPFDocument.java:121)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at com.narola.yujidownloader.OfficeActivity.populateWordX(OfficeActivity.java:605)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at com.narola.yujidownloader.OfficeActivity.populate(OfficeActivity.java:139)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at com.narola.yujidownloader.OfficeActivity.initialize(OfficeActivity.java:111)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at com.narola.yujidownloader.OfficeActivity.onCreate(OfficeActivity.java:96)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at android.app.Activity.performCreate(Activity.java:5008)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at android.app.ActivityThread.access$600(ActivityThread.java:130)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at android.os.Handler.dispatchMessage(Handler.java:99)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at android.os.Looper.loop(Looper.java:137)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at android.app.ActivityThread.main(ActivityThread.java:4745)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at java.lang.reflect.Method.invokeNative(Native Method)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at java.lang.reflect.Method.invoke(Method.java:511)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at dalvik.system.NativeStart.main(Native Method)
  04-08 05:34:20.407: E/AndroidRuntime(1222): Caused by: java.lang.NoClassDefFoundError: org.dom4j.Namespace
  04-08 05:34:20.407: E/AndroidRuntime(1222):     at org.apache.poi.openxml4j.opc.internal.unmarshallers.PackagePropertiesUnmarshaller.&lt;clinit&gt;(PackagePropertiesUnmarshaller.java:49)
  </code></pre>
  
  <p>I have referred <a href="http://poi.apache.org/document/index.html" rel="nofollow">Apchae POI docx</a></p>
  
  <p>Please guide me </p>