Android – 将doc,docx页面和xls,xlsx表格转换为使用apache POI的html

我正在开发一个Android应用程序。 其中我想在我的应用程序中显示文档,docx,xl​​x,xlsx文件。

在谷歌search后,我才知道,apachi POI将这些文件转换为HTML。 所以我已经将“poi-3.8-20120326.jar”添加到libs文件夹中,并尝试构build应用程序。 但是我确实遇到了一些达尔维克构build问题。

所以,我search了这个问题,发现POI jar是支持不完全支持android的java应用程序。

我有一些转换ppt,pptx文件的开源。 https://github.com/qhm123/POI-Android

在这些源代码中,他们已经下载了apache poi源代码,并在应用程序中添加了源代码,并用它来转换ppt,pptx文件。

所以我用下面的代码为doc,docx页面为html。

WordToHtmlConverter.main(new String[]{"/sdcard/office/sample.doc", "/sdcard/office/sample.html"}); 

为此,我在应用程序项目中添加了“org.apache.poi.hwpf”包。 但是我得到了上面提到的同样的dalvik构build问题。 所以我无法构build应用程序。

那么我怎样才能做到这一点使用Apache POI?

Dalvik错误:

 [2014-12-01 13:55:27 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.chainsaw.ControlPanel$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:27 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.chainsaw.ControlPanel$2) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:27 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.chainsaw.ControlPanel$3) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:27 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.chainsaw.ControlPanel$4) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:27 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.chainsaw.ControlPanel$5) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:27 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.chainsaw.ControlPanel$6) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:27 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.chainsaw.ControlPanel$7) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:28 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.chainsaw.Main$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:28 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.chainsaw.MyTableModel$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:29 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.lf5.util.LogFileParser$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:29 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.lf5.viewer.LF5SwingUtils$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:29 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.lf5.viewer.LogBrokerMonitor$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:29 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.lf5.viewer.LogBrokerMonitor$2) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:29 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.lf5.viewer.LogBrokerMonitor$4) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:29 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.lf5.viewer.LogFactor5ErrorDialog$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:29 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.lf5.viewer.LogFactor5InputDialog$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:29 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.lf5.viewer.LogFactor5InputDialog$2) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:29 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.lf5.viewer.LogFactor5InputDialog$3) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:29 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.lf5.viewer.categoryexplorer.CategoryExplorerModel$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:29 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.lf5.viewer.categoryexplorer.CategoryExplorerTree$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:29 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.lf5.viewer.categoryexplorer.CategoryNodeEditor$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:30 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.log4j.xml.DOMConfigurator$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:38 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:38 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.SimpleLog$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:38 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.WeakHashtable$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:38 - POI-operations] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.WeakHashtable$2) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2014-12-01 13:55:50 - Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl; [2014-12-01 13:55:50 - POI-operations] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;