2013-03-28 29 views
0

我想將word和excel文檔轉換爲html,以便在我的android應用程序的瀏覽器中顯示它們。將word和excel轉換爲android上的html

我發現的Apache POI庫,但它實際上只是文本轉換不喜歡的形式,圖表,藝術字等對象或者是有可能,我忘了什麼事?

我也發現apache tika,但是當我將該庫添加到我的項目中時,由於java堆空間錯誤(我在eclipse.ini文件中設置了Xms768m和Xmx2048m),我無法編譯它。我也嘗試在運行時加載該庫,並嘗試使用dx工具,但是出現了內存異常。

我該怎麼做,或者有沒有可能在android應用程序中顯示office文檔?

+0

有一些庫可以處理MS Office文檔,您怎麼看待將它們保存爲.pdf然後顯示它們? – 2013-03-28 10:24:38

+0

將它們保存爲pdf可能會很好。你能否給我一些這樣的圖書館的例子? – 2013-03-28 10:36:56

+0

也許從http://www.docx4java.org檢查導出功能 – 2013-03-28 10:39:06

回答

0

要在使用dexer處理OOM錯誤:

,使用的是DX腳本會在構建並將其設置爲dexer默認堆大小。該腳本住在這裏:

$ ANDROID_SDK /編譯工具/ DX(或dx.bat取決於OS)。

有一個部分在那裏,看起來像這樣:

# By default, give dx a max heap size of 1 gig. This can be overridden 
# by using a "-J" option (see below). 
defaultMx="-Xmx1024M" 

# The following will extract any initial parameters of the form 
# "-J<stuff>" from the command line and pass them to the Java 
# invocation (instead of to dx). This makes it possible for you to add 
# a command-line parameter such as "-JXmx256M" in your scripts, for 
# example. "java" (with no args) and "java -X" give a summary of 
# available options. 

javaOpts="" 

也許嘗試改變javaOpts到-Xmx2048M或類似的東西。