当前位置:网站首页>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
边栏推荐
- switch使用(微信小程序)
- L2-024 tribe (25 points)
- 基于ibeacons签到系统
- 关于stream流,浅记一下------
- MySQL 修改主数据库
- Nacos+AspnetCore+Ocelot实战编码
- Choreographer full resolution
- 生产环境——
- 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
- try --finally
猜你喜欢

关于pthread多线程一些好文章

SQL数据库

Quartus prime hardware experimental development (de2-115 board) experiment 1 CPU instruction calculator design

groutine

基于CM管理的CDH6.3.2集群集成Atlas2.1.0

微信小程序通过低功耗蓝牙设备进行定位及测距(二)

smart-doc + torna生成接口文档

商家案例 | 运动健康APP用户促活怎么做?做好这几点足矣

33 million IOPs, 39 microsecond delay, carbon footprint certification, who is serious?

scikit-learn构建模型的万能模板
随机推荐
What is the difference between blue-green publishing, rolling publishing and gray publishing?
3300万IOPS、39微秒延迟、碳足迹认证,谁在认真搞事情?
可否把模板的头文件和源文件分开编译
STM32学习记录0007——新建工程(基于寄存器版)
Basic knowledge learning record
蓝绿发布、滚动发布、灰度发布,有什么区别?
Yarn online dynamic resource tuning
Chapter I review of e-commerce spike products
CentOS mysql多实例部署
Android篇:2019初中级Android开发社招面试解答(中
基于ibeacons签到系统
log4j 输出日志信息到文件中
Interesting talk about network protocol
linux MySQL数据定时dump
The latest development of fed digital currency
编程旅行之函数
Choreographer全解析
SPC简介
JS 力扣刷题 103. 二叉树的锯齿形层序遍历
cnpm的诡异bug