本文介绍了Docx 转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 android 中做简单的 docx 转换应用程序.

I am doing simple docx conversion app in android.

File file = new File(path + "Sample1.docx");
FileInputStream fis = new FileInputStream(file);

 XWPFDocument document = new XWPFDocument( fis);
 XWPFWordExtractor extractor = new XWPFWordExtractor(document);
 String docText = extractor.getText();

在我的 onCreate 方法中添加了上述行.

Added the above line in my onCreate method.

包含 dom4j,poi3.8,poi-ooxml3.8,poi-xml-schema3.8 &libs 文件夹中的 xmlbeans jar.

Included dom4j,poi3.8,poi-ooxml3.8,poi-xml-schema3.8 & xmlbeans jars in libs folder.

当我运行此程序时出现错误无法执行 dex:方法 ID 不在 [0, 0xffff] 中:65536

When i run this i got the error Unable to execute dex: method ID not in [0, 0xffff]: 65536

谷歌搜索,我得到了关于将 jar 转换为 dex 的信息.

Googled and i got the info about converting jar to dex.

没有 dex 是否可以阅读 docx?即使我不想要 xlsx &poi的pptx包.

With out dex is that possible docx reading? Even i dont want xlsx & pptx packages of poi.

我只想要隐蔽的 doc 和 docx 文件.是否有仅用于 doc&docx 转换的单独代码.

I want covert only doc and docx file. Is there any separate code for only doc&docx conversion.

谢谢

推荐答案

我能够让 JWord 在安卓.和您一样,Apache POI 有很多问题(转换为 Dalvik 格式失败).

I was able to make JWord working under Android. Had many issues with Apache POI like you have (Conversion to Dalvik format failed).

这篇关于Docx 转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 12:10