当前位置:网站首页>Jacob print word
Jacob print word
2022-04-23 14:03:00 【one billion twenty-nine million one hundred and seventy-nine th】
One 、 Preface
utilize jacob Print word, The first thing you need to jacob.jar and jacob.dll Two tools , Are all low-level tools , Just use it . Print word It actually involves a series of word The operation of , For example, replace text , Or into pdf wait , I suggest taking advantage of poi operation word better , Simple , convenient .
Two 、 Download tool
WeChat official account search : The small white XBIT
Reply key :jacob You can get the above two tools
3、 ... and 、 Tool use
1:jacob.jar
(1) Put it in the installation jdk Of bin Directory and jre Under the directory of , At the same time, it should be placed in web-inf Of lib Next, and then build Just a second .
(2) Put it in the installation jdk Of bin Directory and jre Under the directory of , Directly on tomcat Of lib The directory can also ( This is recommended ), The first usually causes loading conflicts .
2:jacob.dll
take jacob.all Put it in C:\Windows\System32 that will do . Pay attention to put the number of corresponding digits according to the number of digits of the computer dll,32 and 64 I have provided download .
Four 、 Print code
/*
* Print the document under the specified path
*/
public String print(String path) {
ComThread.InitSTA();
ActiveXComponent word=new ActiveXComponent("Word.Application");
Dispatch doc=null;
Dispatch.put(word, "Visible", new Variant(false));
Dispatch docs=word.getProperty("Documents").toDispatch();
doc=Dispatch.call(docs, "Open", path).toDispatch();
try {
Dispatch.call(doc, "PrintOut");// Print
return "succ";
} catch (Exception e) {
e.printStackTrace();
return "fail";
}finally{
try {
if(doc!=null){
Dispatch.call(doc, "Close",new Variant(0));
}
} catch (Exception e2) {
e2.printStackTrace();
}
// Release resources
ComThread.Release();
}
}
版权声明
本文为[one billion twenty-nine million one hundred and seventy-nine th]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231401298386.html
边栏推荐
猜你喜欢
Quartus prime hardware experimental development (de2-115 board) experiment 1 CPU instruction calculator design
PATH环境变量
Wechat applet
crontab定时任务输出产生大量邮件耗尽文件系统inode问题处理
Special test 05 · double integral [Li Yanfang's whole class]
Intégration de Clusters CDH Phoenix basée sur la gestion cm
Record a strange bug: component copy after cache component jump
STM32 learning record 0007 - new project (based on register version)
Prediction of tomorrow's trading limit of Low Frequency Quantization
Crontab timing task output generates a large number of mail and runs out of file system inode problem processing
随机推荐
UML Unified Modeling Language
Expression「Func「TSource, object」」 转Expression「Func「TSource, object」」[]
Oracle告警日志alert.log和跟踪trace文件中文乱码显示
Nacos+AspnetCore+Ocelot实战编码
烟雾传感器(mq-2)使用详细教程(基于树莓派3b+实现)
编程旅行之函数
Crontab timing task output generates a large number of mail and runs out of file system inode problem processing
变长参数__VA_ARGS__ 和 写日志的宏定义
FBS(fman build system)打包
try --finally
Scientists say Australian plan to cull up to 10,000 wild horses doesn’t go far enough
Decimal 格式化小数位/DateTime 转换处理
Restful WebService和gSoap WebService的本质区别
33 million IOPs, 39 microsecond delay, carbon footprint certification, who is serious?
_模_板_
微信小程序setInterval定时函数使用详细教程
基于CM管理的CDH集群集成Phoenix
CentOS mysql多实例部署
Android篇:2019初中级Android开发社招面试解答(中
Spark入门基本操作