简体   繁体   English

如何在Android中显示DOCX文档

[英]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.

相关问题 如何在 Android 中使用外部应用程序打开文档 pdf/docx - How open document pdf/docx with external app in Android 如何在Android Activity上的textview中显示.docx文件内容? - How to display .docx file contents in a textview on Android Activity? 如何使用Docx4j在Android视图中显示ppt文件? - How to display ppt file in Android views using Docx4j? Android应用程式检视文件档案('.docx','。pdf'…) - Android app view document files('.docx', '.pdf' …) 如何在Android中异步显示pdf文档? - How to display pdf document asynchronously in android? Docx4J (Android):如何读取 Word 文档中页眉和页脚的内容 - Docx4J (Android): How to read contents of header and footer in Word document 在android活动中显示docx文件的内容 - Display contents of docx file in android activity 如何在Android的列表视图中显示存储中的doc,docx,pdf,xls,txt - how to display doc, docx, pdf, xls, txt from storage in listview in Android 如何使用docx4j在android活动中显示/显示/读取/编辑xlsx内容? - How to show/display/read/edit xlsx content in android activity using docx4j? 如何通过将文本转换为 pdf 和 pdf 到 android 中的 docx 将文本转换为 docx - How to convert text to docx by converting text to pdf and pdf to docx in android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM