当前位置:网站首页>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
边栏推荐
- CentOS mysql多实例部署
- FDFS start
- 基于Ocelot的gRpc网关
- Redis docker 安装
- JMeter pressure test tool
- Pytorch 经典卷积神经网络 LeNet
- China creates vast research infrastructure to support ambitious climate goals
- 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用户促活怎么做?做好这几点足矣
- 专题测试05·二重积分【李艳芳全程班】
猜你喜欢
随机推荐
容差分析相关的计算公式
try --finally
Jiannanchun understood the word game
linux安装mysql后修改密码
AtCoder Beginner Contest 248C Dice Sum (生成函数)
centOS下mysql主从配置
VsCode-Go
SQL: How to parse Microsoft Transact-SQL Statements in C# and to match the column aliases of a view
JMeter pressure test tool
微信小程序与低功耗蓝牙通信-往硬件端发送数据(三)
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
Basic knowledge learning record
AtomicIntegerArray源码分析与感悟
STM32 learning record 0007 - new project (based on register version)
log4j 输出日志信息到文件中
Neuron and neural network
Windos中安装labellmg教程
Android interview theme collection
Ptorch classical convolutional neural network lenet
多重继承虚基类习题









