用Java打开Microsoft Word docx文件 [英] Open Microsoft Word docx file with Java

查看:192
本文介绍了用Java打开Microsoft Word docx文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Java中打开Microsoft Word docx文件?此外,如果密码保护,我该如何打开它?



例如,

  File f = new File(hello.docx); 

请尽量避免回应诸如你不应该这样做。我有一个很好的理由,所以当你回答时请坚持这个问题。非常感谢!

解决方案

Apache POI 项目与MS Office文件工作。 DOCX文件只是一个包含一系列XML文件的zip文件,因此您可以解压缩该文件并使用XML。 XML规范(Open XML)是已知的。


How can I open a Microsoft Word docx file in Java? furthermore, how can I open it if it is password protected?

For instance,

File f = new File("hello.docx");

Please try to avoid responding with things such as "you shouldn't do this." I have a good reason for this, so please stick to the question when you answer. thanks a lot!

解决方案

There is Apache POI project for working with MS Office files. DOCX file is just a zip file with series of XML files inside, so you can unzip the file and work with XML. The XML spec (Open XML) is known.

这篇关于用Java打开Microsoft Word docx文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆