Android - конвертирайте doc, docx страници и xls, xlsx листове в html с помощта на apache POI

Разработвам приложение за android. В който искам да покажа doc, docx, xlx, xlsx файловете в моето приложение.

След като потърсих в Google, разбрах, че Apachi POI ще конвертира тези файлове в html. Така че добавих "poi-3.8-20120326.jar" в папката libs и се опитах да създам приложението. Но се сблъсках с някакъв проблем с изграждането на dalvik.

И така, потърсих за този проблем и открих, че POI jar поддържа java приложения, които не се поддържат напълно за android.

Имам някакъв отворен код за конвертиране на 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, който споменах по-горе. Така че не можах да създам приложението.

И така, как мога да направя това с помощта на 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;

person SKK    schedule 01.12.2014    source източник
comment
Моля, можете ли да прикачите съобщението за грешка на Dalvik?   -  person kameny    schedule 01.12.2014
comment
@kameny : Актуализирах грешката на Dalvik във въпроса.   -  person SKK    schedule 01.12.2014