当前位置: 首页 > news >正文

做网站的最佳方法免费的网络推广有哪些

做网站的最佳方法,免费的网络推广有哪些,建筑行业公司,横沥做网站打印机是最常见的办公设备了。一般情况下如果需要实现打印&#xff0c;可通过前端print.js包来完成。但是&#xff0c;如果要实现智能办公打印&#xff0c;就可以使用JNI技术、封装接口、远程调用实现完成。 导包 jacob&#xff1a;Java COM Bridge <dependency><g…

打印机是最常见的办公设备了。一般情况下如果需要实现打印,可通过前端print.js包来完成。但是,如果要实现智能办公打印,就可以使用JNI技术、封装接口、远程调用实现完成。

导包

jacob:Java COM Bridge

<dependency><groupId>net.sf.jacob-project</groupId><artifactId>jacob</artifactId><version>1.14.3</version>
</dependency>

下载:jacob-1.18-x64.dll

接口开发

service

/*** @Author lyonardo* @Description 打印* @Date 16:20 2020/1/20* @Param [filePath, startMsg, endMsg, cause, departId]* @return com.xxx.basic.response.ReturnData**/@Overridepublic ReturnData excelPrint(String filePath, Long startMsg, Long endMsg, String cause, Integer departId) {try {//下载驱动FileUtil.saveUrlAs(fileServerPath+"/file/", "jacob-1.18-x64.dll", "C:/Windows/System32", "GET");String excelName = "xx市中级人民法院办理减刑案件情况统计表";String outFilename = buildOutFilename(excelName,startMsg,endMsg);//判断文件是否已经生成String excelDownloadPath = "";if(FileUtils.directoryContains(new File("/rpcs/excel"), new File("/rpcs/excel/download"+"/"+outFilename))){excelDownloadPath = "/rpcs/excel/download"+"/"+outFilename;}else{CaseStatVo caseStatVo = getCaseStatVo(startMsg, endMsg, cause, departId);ExportUtils.excelWrite(fileServerPath, caseStatVo, filePath,outFilename, JodaTimeUtil.formatDate2ToString(startMsg, endMsg));excelDownloadPath = "/rpcs/excel/download"+"/"+outFilename;}//打印指定文件名文件Integer i = PrintUtil.printOfficeFile(excelDownloadPath);if (1 == i) return ReturnData.operateSuncess();} catch (IOException e) {e.printStackTrace();}return ReturnData.operateFail();}

PrintUtil封装

/*** @Author lyonardo* @Description Office打印* @Date 14:49 2019/9/23* @Param [filePath 文件路径]* @return boolean
**/
public static Integer printOfficeFile(String filePath) {String postfixString = FileUtil.getFilePathExtensions(filePath);if (postfixString.equalsIgnoreCase("xls")|| postfixString.equalsIgnoreCase("xlsx")) {/*** 功能:实现excel打印工作*/ComThread.InitSTA();ActiveXComponent xl = new ActiveXComponent("Excel.Application");try {// System.out.println("version=" +// xl.getProperty("Version"));// 不打开文档Dispatch.put(xl, "Visible", new Variant(false));Dispatch workbooks = xl.getProperty("Workbooks").toDispatch();// 打开文档Dispatch excel = Dispatch.call(workbooks, "Open",filePath).toDispatch();// 横向打印//     Dispatch currentSheet = Dispatch.get(excel, "ActiveSheet")//       .toDispatch();//     Dispatch pageSetup = Dispatch//       .get(currentSheet, "PageSetup").toDispatch();//     Dispatch.put(pageSetup, "Orientation", new Variant(2));//每张表都横向打印Dispatch sheets = Dispatch.get(excel, "Sheets").toDispatch();// 获得几个sheetint count = Dispatch.get(sheets, "Count").getInt();//     System.out.println(count);for (int j = 1; j <=count; j++) {Dispatch sheet = Dispatch.invoke(sheets, "Item",Dispatch.Get, new Object[] { new Integer(j) },new int[1]).toDispatch();Dispatch pageSetup = Dispatch.get(sheet, "PageSetup").toDispatch();Dispatch.put(pageSetup, "Orientation", new Variant(2));Dispatch.call(sheet, "PrintOut");}// 开始打印if (excel != null) {//Dispatch.call(excel, "PrintOut");//增加以下三行代码解决文件无法删除bugDispatch.call(excel, "save");Dispatch.call(excel,  "Close" ,  new  Variant(true));excel=null;}xl.invoke("Quit", new Variant[] {});xl=null;return 1;} catch (Exception e) {e.printStackTrace();return 0;} finally {// 始终释放资源ComThread.Release();}}else if (postfixString.equalsIgnoreCase("doc")|| postfixString.equalsIgnoreCase("docx")) {ComThread.InitSTA();ActiveXComponent wd = new ActiveXComponent("Word.Application");try {// 不打开文档Dispatch.put(wd, "Visible", new Variant(false));Dispatch document = wd.getProperty("Documents").toDispatch();// 打开文档Dispatch doc = Dispatch.invoke(document, "Open",Dispatch.Method, new Object[] { filePath },new int[1]).toDispatch();// 开始打印if (doc != null) {Dispatch.call(doc, "PrintOut");Dispatch.call(doc, "save");Dispatch.call(doc,  "Close" ,  new  Variant(true));doc=null;}wd.invoke("Quit", new Variant[] {});wd=null;return 1;} catch (Exception e) {e.printStackTrace();return 0;} finally {// 始终释放资源ComThread.Release();}}else {return 0;}
}

测试

  @Testpublic void test(){String filePath  = "C:/Users/Administrator/Desktop/xx市中级人民法院办理减刑案件情况统计表.xlsx";//String printerName = "FX DocuPrint M115 b";//打印机名包含字串PrintUtil.printOfficeFile(filePath);}
http://www.hkea.cn/news/280124/

相关文章:

  • wordpress屏蔽f12广州seo网络优化公司
  • 南宁网站建设推广服务云服务器免费
  • 大数据营销是什么seo站长
  • 建设政府网站的公司乐山网站seo
  • 仿站容易还是建站容易专业做灰色关键词排名
  • 做网站背景音乐管理课程培训
  • 网站建设可以自学吗品牌软文范文
  • 网站风格对比哪里有学计算机培训班
  • 做mla的网站网站优化哪家好
  • 网站注册的账号怎么注销线上营销活动有哪些
  • 国内做进口的电商网站网站推广软件哪个好
  • 谁有做那事的网站百度投诉中心入口
  • 免费单页网站在线制作沈阳seo排名优化教程
  • 廊坊网站建大型网站建站公司
  • 远程桌面做网站sem和seo区别与联系
  • 做贷款网站优化大师有用吗
  • 有没有便宜的网站制作制作网页教程
  • 医院网站制作优化关键词的方法有哪些
  • wordpress安装到网站吗泰安seo
  • 长春网站开发培训价格google play三件套
  • 做生存分析的网站有哪些国外新闻最新消息
  • 济南网站优化收费百度互联网营销
  • bootstrap响应网站模板下载发帖推广百度首页
  • 动态网站上的查询怎么做新媒体运营培训学校
  • 网站开发人员必备技能百度优化推广
  • 花都 网站建设百度推广怎么添加关键词
  • 开发公司成本部职责岗位职责和流程苏州网站建设优化
  • 湛江网站制作系统seo排名需要多少钱
  • 城乡现代社区建设seo关键词推广案例
  • 旅游网站开发外文文献关键洞察力