当前位置: 首页 > news >正文

宁波新冠疫情最新消息手机优化大师下载2022

宁波新冠疫情最新消息,手机优化大师下载2022,安徽省工程建设信用平台网站,做分销网站多少钱1.先下载office2007 能另存为pdf的插件 SaveAsPDFandXPS.exe 安装 2.附件提供了jacob1.9的下载 3.这点很重要也是耗时我最久的就是jacob.dll与jacob.jar的存放位置;位置不对则会出现app.getProperty("Documents").toDispatch()这句话无法正常执行; 位置如下文件存放在…
1.先下载office2007 能另存为pdf的插件 SaveAsPDFandXPS.exe 安装

2.附件提供了jacob1.9的下载

3.这点很重要也是耗时我最久的就是jacob.dll与jacob.jar的存放位置;位置不对则会出现app.getProperty("Documents").toDispatch()这句话无法正常执行;

位置如下文件存放在jdk的 jre下 例如我这边是
jacob.jar 放在 E:\jdk1.5.0_14\jre\lib\ext
jacob.dll 放在 E:\jdk1.5.0_14\jre\bin
下能正常执行;
按网上说的 放在windows\system32下则会出现错误

源代码如下: 

package com;import java.io.File;import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;public class Test
{static final int wdFormatPDF = 17;// PDF 格式public void wordToPDF(String sfileName, String toFileName){System.out.println("启动Word...");long start = System.currentTimeMillis();ActiveXComponent app = null;Dispatch doc = null;try{app = new ActiveXComponent("Word.Application");app.setProperty("Visible", new Variant(false));Dispatch docs = app.getProperty("Documents").toDispatch();doc = Dispatch.call(docs, "Open", sfileName).toDispatch();System.out.println("打开文档..." + sfileName);System.out.println("转换文档到PDF..." + toFileName);File tofile = new File(toFileName);if (tofile.exists()){tofile.delete();}Dispatch.call(doc, "SaveAs", toFileName, // FileNamewdFormatPDF);long end = System.currentTimeMillis();System.out.println("转换完成..用时:" + (end - start) + "ms.");}catch (Exception e){System.out.println("========Error:文档转换失败:" + e.getMessage());}finally{Dispatch.call(doc, "Close", false);System.out.println("关闭文档");if (app != null)app.invoke("Quit", new Variant[] {});}// 如果没有这句话,winword.exe进程将不会关闭ComThread.Release();}public static void main(String[] args){Test d = new Test();d.wordToPDF("E:\\合同文本2014.doc", "E:\\合同文本2014.pdf");}
}


package com;import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;public class TransformFiletoHtml
{public static void wordToPDF(String docfile, String toFile){ActiveXComponent app = new ActiveXComponent("Word.Application"); // 启动wordtry{app.setProperty("Visible", new Variant(false));Dispatch docs = app.getProperty("Documents").toDispatch();Dispatch doc = Dispatch.invoke(docs, "Open", Dispatch.Method,new Object[] { docfile, new Variant(false), new Variant(true) }, new int[1]).toDispatch();// new Variant(type),这里面的type的决定另存为什么类型的文件Dispatch.invoke(doc, "SaveAs", Dispatch.Method, new Object[] { toFile, new Variant(17) }, new int[1]);//Dispatch.invoke(doc, "SaveAs", Dispatch.Method, new Object[] { toFile }, new int[17]);Variant f = new Variant(false);Dispatch.call(doc, "Close", f);}catch (Exception e){e.printStackTrace();}finally{app.invoke("Quit", new Variant[] {});}}public static void main(String[] args){// 源文件全路径String docfile = "D:\\合同文本2014.doc";// 些路径test为实际存在的目录,s后面为要另存为的文件名String toFile = "D:\\合同文本2014.pdf";wordToPDF(docfile, toFile);}
}



http://www.hkea.cn/news/414922/

相关文章:

  • 教我做网站百度打开
  • 网站开发时如何兼容电商运营是做什么的
  • 河北建设银行石家庄分行招聘网站怎么申请自己的网络平台
  • vs2008 做网站搜索引擎的工作原理是什么
  • 东莞常平做网站公司app营销策划方案
  • 爱用建站 小程序重庆网站制作公司
  • 网站建设小企业案例漯河网络推广哪家好
  • wordpress 清空回收站合肥网站优化软件
  • 电站建设招聘网站智推教育seo课程
  • 做静态网站选用什么服务器站长素材网站
  • 网站建设先做前台还是后台百度认证是什么
  • 广州专业做crm系统的供应商seo网站培训班
  • 景安建网站企业网站seo方案案例
  • 山东滕州疫情最新消息今天i长沙官网seo
  • 公司做网站买域名之后做什么百度一下你就知道手机版
  • 北京婚恋网站哪家最好企业推广宣传方式
  • 国发网站建设西安做网站公司
  • 网站推广服务合同简述网络营销的主要方法
  • 信息门户网站是什么成人计算机培训机构哪个最好
  • 网站建设公司 中企动力公司东莞商城网站建设
  • b2c的电子商务网站自己想做个网站怎么做
  • 京东pc网站用什么做的如何注册网站怎么注册
  • 长沙商城网站制作seo线下培训课程
  • web网站开发公司网站制作优化排名
  • 这么做3d网站企业邮箱网页版
  • 瑞安网站建设公司关键词排名网络推广
  • 南京学做网站友情链接检查工具
  • 参考文献网站开发百度重庆营销中心
  • 如何做微信ppt模板下载网站企业网页设计公司
  • 做b2b网站百度点击快速排名