jcaob中读取word中的内容,并显示出来
2017-07-03 09:37
169 查看
ActiveXComponent app = new ActiveXComponent("Word.Application"); // 设置word不可见 app.setProperty("Visible", false); // 获得word中所有打开的文档,返回Documents对象 Dispatch docs = app.getProperty("Documents").toDispatch(); // 调用Documents对象中Open方法打开文档,并返回打开的文档对象Document Dispatch doc = Dispatch.invoke(docs, "Open", Dispatch.Method, new Object[]{inputFile, new Variant(false), new Variant(true)} , new int[1]).toDispatch(); //打开word文件 Dispatch wordContent = Dispatch.get(doc, "Content").toDispatch(); // 取得word文件的内容 System.out.println("我是文件内容:"+Dispatch.get(wordContent, "Text")); // 关闭文档 Dispatch.call(doc, "Close", false); // 关闭word应用程序 app.invoke("Quit", 0);
相关文章推荐
- ASP.net:读取Word内容(包含表格,不包含图片)并且显示在页面中
- C#读取word文档内容并显示
- 读取文件中的内容将其显示出来
- ASP 如何读取 Word 档案内容并显示于网页
- ASP.net:读取Word内容(包含表格,不包含图片)并且显示在页面中
- C源程序:输入当前目录下的文本文件名称,尝试打开文件,逐个字符读取文件内容并显示出来
- web中,如何读取Word内容(包含表格,但不包含图片)并且显示在页面中或保存进数据库中
- web中,如何读取Word内容(包含表格,但不包含图片)并且显示在页面中或保存进数据库中
- ASP 如何读取 Word 档案内容并显示于网页
- Hadoop实验:用java把hdfs系统里的文件内容读取出来,显示到屏幕
- delphi 循环读取word每页的内容显示在OleContainer1内
- 读取客户端word内容并且显示在页面
- 读取excel内容在网页上显示出来
- jsp读取txt文件后,将txt文件内容分页显示
- 读取文件并在屏幕上显示内容
- 救命呀!关于从数据库读取Word文档(BLOB)在JSP页面显示
- c#读取word内容,c#写入word内容,C#操作word
- c#读取word内容,c#提取word内容
- 求助,这样的文本文件如何读取出来并放在一个DataGrid控件中显示?
- ASP读取显示TXT文件内容