当前位置:网站首页>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
边栏推荐
猜你喜欢
Record a strange bug: component copy after cache component jump
趣谈网络协议
PySide2
1256: bouquet for algenon
基于CM管理的CDH集群集成Phoenix
Nodejs安装及环境配置
try --finally
Jenkins construction and use
Taobao released the baby prompt "your consumer protection deposit is insufficient, and the expiration protection has been started"
SQL数据库
随机推荐
Android interview theme collection
Neuron and neural network
收藏博客贴
Decentralized Collaborative Learning Framework for Next POI Recommendation
Pytorch 经典卷积神经网络 LeNet
poi操作word模板替换数据并且导出word
Lin Lin, product manager of Lenovo: network failure of local network operator in Tianjin. The background server of Zui system can't work normally for the time being
商家案例 | 运动健康APP用户促活怎么做?做好这几点足矣
request模块
JS 烧脑面试题大赏
JS force deduction brush question 103 Zigzag sequence traversal of binary tree
[code analysis (7)] communication efficient learning of deep networks from decentralized data
JS 力扣刷题 103. 二叉树的锯齿形层序遍历
Windos中安装labellmg教程
Chapter I review of e-commerce spike products
基于ibeacons签到系统
About note 1
json反序列化匿名数组/对象
Interesting talk about network protocol
多线程 @Async 线程池