当前位置:网站首页>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
边栏推荐
猜你喜欢
联想产品经理林林:天津当地网络运营商网络故障 ZUI系统后台服务器暂时无法正常工作
STM32学习记录0007——新建工程(基于寄存器版)
Crontab timing task output generates a large number of mail and runs out of file system inode problem processing
基于ibeacons三点定位(微信小程序)
JS 烧脑面试题大赏
Nodejs安装及环境配置
The art of automation
微信小程序通过低功耗蓝牙设备进行定位及测距(二)
分库分表 & ShardingSphere
Programming travel function
随机推荐
记录一个奇怪的bug:缓存组件跳转之后出现组件复制
request模块
趣谈网络协议
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
项目中遇到的问题(五)操作Excel接口Poi的理解
对List集合进行分页
Haruki Murakami -- Excerpt from "what do I talk about when I talk about running"
Logging模块
3300万IOPS、39微秒延迟、碳足迹认证,谁在认真搞事情?
快捷键(多行)
SQL: How to parse Microsoft Transact-SQL Statements in C# and to match the column aliases of a view
Quartus prime hardware experimental development (de2-115 board) experiment II function adjustable comprehensive timer design
centOS下mysql主从配置
Pytorch 经典卷积神经网络 LeNet
联想产品经理林林:天津当地网络运营商网络故障 ZUI系统后台服务器暂时无法正常工作
Atcoder beginer contest 248c dice sum (generating function)
微信小程序进行蓝牙初始化、搜索附近蓝牙设备及连接指定蓝牙(一)
变长参数__VA_ARGS__ 和 写日志的宏定义
基于ibeacons三点定位(微信小程序)
switch使用(微信小程序)