基于jacob插件实现 word,excel,ppt 转换 pdf

时间:2021-07-02 08:00:37
【文件属性】:

文件名称:基于jacob插件实现 word,excel,ppt 转换 pdf

文件大小:4.33MB

文件格式:ZIP

更新时间:2021-07-02 08:00:37

jacob的使用 excel转换 word转换 ppt转换

基于jacob插件实现 word,excel,ppt 转换 pdf,如下所示: public void excel2pdf(String source, String target) { System.out.println("启动Excel"); long start = System.currentTimeMillis(); ActiveXComponent app = new ActiveXComponent("Excel.Application"); // 启动excel(Excel.Application) try { app.setProperty("Visible", false); Dispatch workbooks = app.getProperty("Workbooks").toDispatch(); System.out.println("打开文档" + source); Dispatch workbook = Dispatch.invoke(workbooks, "Open", Dispatch.Method, new Object[]{source, new Variant(false),new Variant(false)}, new int[3]).toDispatch(); Dispatch.invoke(workbook, "SaveAs", Dispatch.Method, new Object[] { target, new Variant(57), new Variant(false), new Variant(57), new Variant(57), new Variant(false), new Variant(true), new Variant(57), new Variant(true), new Variant(true), new Variant(true) }, new int[1]); Variant f = new Variant(false); System.out.println("转换文档到PDF " + target); Dispatch.call(workbook, "Close", f); long end = System.currentTimeMillis(); System.out.println("转换完成..用时:" + (end - start) + "ms."); } catch (Exception e) { System.out.println("========Error:文档转换失败:" + e.getMessage()); }finally { if (app != null){ app.invoke("Quit", new Variant[] {}); } } }


【文件预览】:
jar
----使用前必看.txt(488B)
----jacob-1.19-x86.dll(164KB)
----itext-4.2.1.jar(2.14MB)
----jacob.jar(48KB)
----jacob-1.19-x64.dll(201KB)
ToPdf
----WebContent()
--------META-INF()
--------WEB-INF()
----.settings()
--------org.eclipse.wst.jsdt.ui.superType.name(6B)
--------org.eclipse.wst.common.project.facet.core.xml(345B)
--------org.eclipse.wst.common.component(467B)
--------org.eclipse.wst.jsdt.ui.superType.container(49B)
--------.jsdtscope(567B)
--------org.eclipse.jdt.core.prefs(364B)
----src()
--------com()
----.project(905B)
----.classpath(990B)
----build()
--------classes()

网友评论