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

赤壁市建设工程造价信息价网站查询wordpress 获取某个栏目名称

赤壁市建设工程造价信息价网站查询,wordpress 获取某个栏目名称,织梦做商城类网站教程,做网站兼容性如何处理使用到的工具有#xff1a; 开发工具#xff1a;IDEA 报表开发工具#xff1a;帆软10.0.19 1、针对帆软报表[普通报表]的设置 1.1首先选中在帆软里制作好的报表#xff0c;选择模板web属性 1.2.选择数据分析模式#xff0c;添加一个事件设置#xff0c;该事件应该设置“…使用到的工具有 开发工具IDEA 报表开发工具帆软10.0.19 1、针对帆软报表[普通报表]的设置 1.1首先选中在帆软里制作好的报表选择模板web属性 1.2.选择数据分析模式添加一个事件设置该事件应该设置“加载结束” 1.3.在Js脚本里写这段代码 var node document.getElementsByClassName(x-table)[0].parentElement; var message {nodeId: 自定义一个别名,nodeInnerHTML: node.innerHTML }; window.parent.postMessage(message, *);–绘制表格及如何将帆软报表展示到html不做过多赘述 给生成PPT方法添加一个按钮事件 $(#DOWNLOAD).on(click, function () {//给每个表格设置一个新的IDupdateTableId();var timeBucket $(#inqu_status-0-timeBucket).val();let orderYear timeBucket.substring(0, 4)let orderMonth timeBucket.substring(4, 6)let orderYearC orderYear 年let orderMonthC orderMonth 月var inInfo new EiInfo();var promises []; // 存储生成图片的 Promise//确保每个table都生成了BASE64编码document.querySelectorAll(.html2canvas table).forEach((v, k, p) {var promise html2canvas(document.querySelector(# v.id), {}).then((canvas) {//根据当前id获取tr的数量。1tr假设等于11PX 从而计算出数据表格的高度let tableHeight v.querySelectorAll(tr).length * 11;let src canvas.toDataURL(image/png).replace(image/png, image/octet-stream); // 将canvas转换成img的src流console.log(v.id, k)inInfo.set(v.id, src)inInfo.set(v.id Height, tableHeight.toString())});promises.push(promise);})//所有报表的base64编码都在promises里后调用后台服务Promise.all(promises).then(() {inInfo.set({{Year}}, ${orderYear})inInfo.set({{Month}}, ${orderMonth})inInfo.set({{YearC}}, ${orderYearC})inInfo.set({{MonthC}}, ${orderMonthC})inInfo.set({{YearMonth}}, ${orderYear}${orderMonth})inInfo.set({{YearMonthC}}, ${orderYearC}${orderMonthC})var jsonEi inInfo.toJSONString(true);console.log(jsonEi)post(IPLATUI.CONTEXT_PATH /DownloadAgree, {temporaryId: PM15, jsonEi: jsonEi});// IPLAT.progress($(#result), false);});IPLAT.progress($(#result), false);})function updateTableId() {var tables document.querySelectorAll(table[class^x-table]);for (var i 0; i tables.length; i) {tables[i].setAttribute(id, newTableId i);num i;} }调用后台DownloadAgree通过该服务去调用具体实现方法 package com.baosight.bgdsp.rp.pm;import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.service.soa.XLocalManager;import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException;public class DownloadAgree extends HttpServlet{Overrideprotected void doGet(HttpServletRequest request, HttpServletResponse response) {EiInfo eiInfo EiInfo.parseJSONString(request.getParameter(jsonEi));String temporaryId request.getParameter(temporaryId);if (temporaryId.equals(PM)) {eiInfo.set(response, response);eiInfo.set(EiConstant.serviceName, RPPM07);eiInfo.set(EiConstant.methodName, exportPPT);eiInfo XLocalManager.callNewTx(eiInfo);}if (temporaryId.equals(PM15)) {eiInfo.set(response, response);eiInfo.set(EiConstant.serviceName, RPPM15);eiInfo.set(EiConstant.methodName, exportPPT);eiInfo XLocalManager.callNewTx(eiInfo);}}protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{doGet(request, response);} } exportPPT方法 public EiInfo exportPPT(EiInfo inInfo) throws IOException {HttpServletResponse response (HttpServletResponse) inInfo.get(response);// 创建一个空的演示文稿String url ;String os System.getProperty(os.name).toLowerCase();boolean isMacOS os.contains(mac);if (isMacOS) {url PlatApplicationContext.getProperty(bgdsp. projectEnv .share.template.mac);} else {url PlatApplicationContext.getProperty(bgdsp. projectEnv .share.template);}String tempName PlatApplicationContext.getProperty(bgdsp. projectEnv .share.template.rppm15);// 读取模板文件//InputStream resource new ClassPathResource(/Users/apple/Desktop/-job/2022-development/iplat4j/渠道长龄库存压降情况汇报_template.pptx).getInputStream();FileInputStream inputStream new FileInputStream(url tempName); // FileInputStream inputStream new FileInputStream(E:// tempName);// 根据模板创建一个新的ppt文档XMLSlideShow ppt new XMLSlideShow(inputStream);// 读取模板PPTinputStream.close();MapString, String attr inInfo.getAttr();attr.put(netPrice_2, getReportsToimage());// ListXSLFSlide slides ppt.getSlides();// 得到每页pptXSLFSlide[] slides ppt.getSlides().toArray(new XSLFSlide[0]);// 遍历ppt填充模板for (XSLFSlide slide : slides) { // ListXSLFShape shapes slide.getShapes();XSLFShape[] shapes slide.getShapes().toArray(new XSLFShape[0]);// 遍历每页ppt中待填充的形状组件for (XSLFShape shape : shapes) {if (shape instanceof XSLFTextShape) {// 替换文本XSLFTextShape textShape (XSLFTextShape) shape;String textValue textShape.getText();String shapeName textShape.getShapeName();boolean flag false;for (String text : extractContent(textValue)) {if (attr.containsKey(text)) {flag true;//使用mustache语法替换文字 {{YearC}}营{{MonthC}}销预案会textValue textValue.replace(text, attr.get(text));}}if (flag StringUtils.isNotBlank(textValue)) {ListXSLFTextParagraph paragraphs textShape.getTextParagraphs();for (XSLFTextParagraph paragraph : paragraphs) {ListXSLFTextRun textRuns paragraph.getTextRuns();for (XSLFTextRun textRun : textRuns) {textRun.setText();}}XSLFTextRun textRun2 textShape.getTextParagraphs().get(0).getTextRuns().get(0);textRun2.setText(textValue);}} else if (shape instanceof XSLFPictureShape) {XSLFPictureShape pictureShape (XSLFPictureShape) shape;XSLFPictureData pictureData pictureShape.getPictureData();String imageName pictureShape.getShapeName();String imageBase64 attr.get(imageName);if (imageBase64 ! null) {byte[] bt Base64.getDecoder().decode(imageBase64.split(,)[1]);XSLFPictureData idx ppt.addPicture(bt, PictureData.PictureType.PNG);XSLFPictureShape pic slide.createPicture(idx);Rectangle2D anchor pictureShape.getAnchor();//高度取决于数据表格的条数 宽度固定pic.setAnchor(new Rectangle2D.Double(anchor.getX(), anchor.getY(), anchor.getWidth(), anchor.getHeight()));pictureShape.setAnchor(new Rectangle2D.Double(10, 0, 0, 0));}}}}String fileName PPT名字 DateUtils.curDateTimeStr14() .pptx;// 保存PPT文件//设置输出文件类型为pptx文件response.setContentType(CONTENT_TYPE_OF_PPT);response.setHeader(Content-Disposition, attachment;fileName URLEncoder.encode(fileName, CHARSET_OF_UTF8));response.setHeader(Pragma, URLEncoder.encode(fileName, CHARSET_OF_UTF8));ServletOutputStream outputStream response.getOutputStream();ppt.write(outputStream);outputStream.flush();outputStream.close();return new EiInfo();}extractContent方法 public static ListString extractContent(String input) {ListString contents new ArrayList();int startIndex input.indexOf({{);while (startIndex ! -1) {int endIndex input.indexOf(}}, startIndex);if (endIndex ! -1) {String content input.substring(startIndex, endIndex 2);contents.add(content);startIndex input.indexOf({{, endIndex);} else {break;}}return contents;}getReportsToimage()方法该方法针对的是帆软报表的普通报表中出现非表格报表的处理方法[即柱状图、折线图等]通过直接访问帆软链接的方式去获取表格的base64编码。 private String getReportsToimage() throws IOException {String reportAddress PlatApplicationContext.getProperty(bgdsp. projectEnv .report.address);// 创建HttpClient对象CloseableHttpClient httpClient HttpClients.createDefault();try {// 构造请求URLString apiUrl reportAddress /rp/pm/netPrice_2.cptformatimageextypeJPG;// 创建HttpGet请求//HttpPost request new HttpPost(apiUrl);System.out.println(apiUrl);System.out.println(apiUrl);HttpGet httpGet new HttpGet(apiUrl);// 设置请求头部httpGet.addHeader(Content-Type, text/html; charsetutf-8);// 发送请求并获取响应HttpResponse responsed httpClient.execute(httpGet);// 解析响应数据HttpEntity entity responsed.getEntity();// 检查响应是否成功if (responsed.getStatusLine().getStatusCode() HttpStatus.SC_OK) {// 获取Content-Type头部信息Header contentTypeHeader entity.getContentType();String contentType contentTypeHeader.getValue();// 获取输入流InputStream inStream entity.getContent();ByteArrayOutputStream outputStream_u new ByteArrayOutputStream();// 将图片裁剪为宽60px高60pxBufferedImage originalImage ImageIO.read(inStream);BufferedImage croppedImage originalImage.getSubimage(0, 0, 3560, 1560);// 将裁剪后的图片转换成字节数组ByteArrayOutputStream outputStream_c new ByteArrayOutputStream();ImageIO.write(croppedImage, png, outputStream_c);byte[] croppedImageBytes outputStream_c.toByteArray();// 将图片数据编码为base64格式String base64Image Base64.getEncoder().encodeToString(croppedImageBytes);System.out.println(base64Image);String responseBody EntityUtils.toString(entity);// 处理响应数据System.out.println(responseBody);// 关闭输入流和输出流inStream.close();outputStream_u.close();return data:image/png;base64, base64Image;} else {System.out.println(HTTP请求失败);}} catch (PlatException e) {}return ;}最后在设置PPT模板的时候将模板内的图片设置为修改后的别名newTableIdi
http://www.zqtcl.cn/news/744681/

相关文章:

  • 企业网站建设招标微信公众平台官网登录入口网页版
  • 网站宣传图网站程序预装
  • 网站设计论文选题seo排名优化推广报价
  • wordpress图床网站百度链接收录
  • 八年级信息网站怎么做电商网站的支付接入该怎么做呢
  • wordpress 的应用大兴安岭地网站seo
  • 网站建站作业做直播网站赚钱
  • 网站建设虍金手指花总简单免费制作手机网站
  • 京东网站是刘强冬自己做的吗献县网站建设价格
  • 余姚什么网站做装修比较好邢台企业做网站哪儿好
  • 网站建设后端国外购物平台排行榜前十名
  • 西安做百度推广网站 怎样备案简述商务网站建设
  • 如何建设本地网站东莞常平限电通知2021
  • 成都网站建设cdajcx重庆推广网站排名价格
  • 建网站的价格网店设计方案计划书
  • 长沙做公司网站如何制作个人网站教程
  • 做一个网站怎么做的仿qq网站程序
  • 曲靖市建设局网站官网织梦可以放两个网站
  • 网站建设方案ppt模板网站怎么做用户登录数据库
  • 做3d图的网站有哪些软件有哪些专业设计企业网站
  • 青海省wap网站建设公司做美工比较好的网站
  • 1个云虚拟主机怎么做多个网站网站规划与建设实验心得
  • led视频网站建设公众号代运营平台
  • 北京微信网站开发费用软件开发做平台
  • 平面设计师必备网站精湛的赣州网站建设
  • 上海市住房和城乡建设部网站官网wordpress页面点赞
  • 试玩平台类网站怎么做的东莞网站关键词推广
  • 网站开发慕枫页面模板怎么删除
  • 网站开发微信小程序需求量大吗珠海新闻头条最新消息
  • 闭站保护对网站影响公司主网站百度收录大量网站之类的信息