[英]How to display DOCX document in Android
I am facing issue while parsing and displaying DOCX document in Android. 在Android中解析和显示DOCX文档时遇到问题。 I am new in this. 我是新来的。 I have tried parsing docx in java using Apache POI and it works fine. 我已经尝试使用Apache POI在Java中解析docx,并且工作正常。 Its little heavy as it needs a lot of jars to execute the code. 它有点沉重,因为它需要很多jar来执行代码。 Below is the sample code in Java: 以下是Java中的示例代码:
FileInputStream fis = new FileInputStream(docPath);
XWPFDocument document = new XWPFDocument(OPCPackage.open(fis));
XWPFWordExtractor extractor = new XWPFWordExtractor(document);
System.out.println(extractor.getText());
It displays the input stream. 它显示输入流。
In case of Android I am facing isssue. 如果是Android,则面临问题。 It gives error like duplicate xmlbeans stuff in xmlBean jar. 它给出了类似xmlBean jar中重复的xmlbeans内容的错误。 I read about it that Android is very strict about duplicate files and it produces issue while java not. 我了解到,Android对重复文件非常严格,它会产生问题,而Java不会。 On top, Apache POI is little bulky as well as it contanis lot of jars and takes alot of space. 最重要的是,Apache POI体积不大,而且罐子很多,占用大量空间。 i am looking for a simple solution for this. 我正在为此寻找一个简单的解决方案。
Please help me out. 请帮帮我。
Thanks in advance. 提前致谢。
There is no direct way to show your docx file
into WebView
, instead you can use AndroidDocxToHtml library , here is the link below:- 没有直接的方法可以将docx file
显示到WebView
,而是可以使用AndroidDocxToHtml库,这是下面的链接:-
https://github.com/plutext/AndroidDocxToHtml https://github.com/plutext/AndroidDocxToHtml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.