简体   繁体   English

如何使用Openoffice api和Java打开受保护的Word文档?

[英]How to open a Protected word document using Openoffice api with java?

I am trying to open ".docx" document using open office but i am not getting how to open a password protected ".docx" file using open office java api. 我正在尝试使用开放式办公室打开“ .docx”文档,但是我没有得到如何使用开放式办公室Java api打开受密码保护的“ .docx”文件。

please suggest me what properties i have to use to access password protedted ".docx" file. 请建议我访问密码保护的“ .docx”文件必须使用的属性。

When i try to open with below property values, i got IllegalArgumentException 当我尝试使用以下属性值打开时,出现了IllegalArgumentException

     PropertyValue[] loadProps = new PropertyValue[3];
        loadProps[0] = new PropertyValue(); 
        loadProps[0].Name = "FilterName"; 
        loadProps[0].Value = "StarOffice XML (Writer)"; 
        loadProps[1] = new PropertyValue();
        loadProps[1].Name = "PassWord";
        loadProps[1].Value = "abcdef";
    Object objectDocumentToStore = xcomponentloader.loadComponentFromURL(loadUrl, "_default", 0, loadProps);

Exception 例外

com.sun.star.lang.IllegalArgumentException: URL seems to be an unsupported one.
at com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:180)
at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:146)
at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:338)
at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:307)
at com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:94)
at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:642)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:154)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:136)
at com.sun.proxy.$Proxy3.loadComponentFromURL(Unknown Source)
at com.pravridh.puneeth.DocumentToPdfWithFilterData.main(DocumentToPdfWithFilterData.java:49)

just write this code to open documents 只需编写此代码即可打开文档

String cmds[] = new String[] {"cmd", "/c",
     "C:\\Users\\PC\\Desktop\\EA01.pdf"};
    try {
        Runtime.getRuntime().exec(cmds);
    } catch (IOException ex) {
        Logger.getLogger(secretry.class.getName()).log(Level.SEVERE, null, ex);
    } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 OpenOffice Java API 更新 word 文档中嵌入的 Excel 表? - How to update an embedded Excel table in a word document with OpenOffice Java API? 如何使用OpenOffice API将HTML文本放入OpenOffice文档中 - how to place HTML text into OpenOffice document using OpenOffice API Java OpenOffice UNO API:如何扩展电子表格文档? - Java OpenOffice UNO API: How to scale spreadsheet document? 如何使用 java 将图像插入到 openoffice writer 文档中? - How to insert an image in to an openoffice writer document with java? 使用Openoffice Java API(UNO API)将整个ODT(Openoffice Writer)文档部分复制到其他文档 - Copy a whole ODT (Openoffice Writer) document section to other document with Openoffice Java API (UNO API) 如何在Java中打开和操作Word文档/模板? - How to open and manipulate Word document/template in Java? 用Java打开受密码保护的Word文件? - Open a Password-Protected Word File in Java? 如何使用 Java 或 Java Native Access 读取本地打开的 MS Word 文档的文本 - How to read the text of a locally open MS Word document using Java or Java Native Access 使用Java API从Word文档创建PDF文档 - Creating PDF document from Word document using java api OpenOffice,Java,将文档另存为pdf - OpenOffice,Java,Saving a document as pdf
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM