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

企业为什么网站建设全网络品牌推广

企业为什么网站建设,全网络品牌推广,房产部门成立网站,盐城网站开发代理商文章目录 后端 doc 转 docxdcox - preview安装导入使用注意 最近菜鸟刚搞完签字,结果需求就加了,如果合同有附件(.doc.docx),签名就是签到附件里面,没有附件才是签到那个html里面! 这里附件签名…

文章目录

  • 后端 doc 转 docx
  • dcox - preview
    • 安装
    • 导入
    • 使用
      • 注意

最近菜鸟刚搞完签字,结果需求就加了,如果合同有附件(.doc.docx),签名就是签到附件里面,没有附件才是签到那个html里面!

这里附件签名过后就不能像html那样可以修改原html了,毕竟这个要写入word文档,实现不了,所以我们公司退而求其次只需要记录附件和签字的对应关系,以及何时签字就行!

实现难点在于:前端只能展示docx;后端也不好把 doc、docx 转换为html !(只能说 doc 是什么天杀的格式?)

后端 doc 转 docx

但是好在后端可以将 doc 转成 docx,菜鸟是前端不知道后端咋搞的,只要了点代码过来,各位可以参考一下:

public void docToDocx(String batchId, HttpServletResponse response) throws IOException {
//  FileEntity data = adminFileService.queryOne(batchId).getData();
//  String path = data.getPath();response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");response.setHeader("Content-Disposition", "attachment; filename=\"converted.docx\"");ServletOutputStream outputStream = response.getOutputStream();File inputWord = new File("E:\\03 项目沟通文档\\1820994860746969088-(7.31第二次修改)农大三代建库测序技术委托合同.doc");try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();InputStream docxInputStream = new FileInputStream(inputWord)) {IConverter converter = LocalConverter.builder().build();boolean flag = false;flag = converter.convert(docxInputStream).as(DocumentType.DOC).to(byteArrayOutputStream).as(DocumentType.DOCX).execute();if (flag) {converter.shutDown();}byteArrayOutputStream.writeTo(outputStream);System.out.println("转换成功");} catch (Exception e) {e.printStackTrace();}
}

后端下载的插件名称:

<dependency><groupId>com.documents4j</groupId><artifactId>documents4j-local</artifactId><version>1.0.3</version>
</dependency>
<dependency><groupId>com.documents4j</groupId><artifactId>documents4j-transformer-msoffice-word</artifactId><version>1.0.3</version>
</dependency>

好了,后端菜鸟就不多废话了,接下来是重头戏前端代码!

dcox - preview

都转化成了 docx 了,那我前端展示也是分分钟的事情!需要使用插件:dcox - preview !

安装

npm i docx-preview --save

导入

import { renderAsync } from 'docx-preview';

使用

js

getPrintApi(route.query.batchId).then(async (res) => {await nextTick();let reportContainer = document.getElementById("reportContainer");renderAsync(res,reportContainer, // HTMLElement 渲染文档内容的元素,null // HTMLElement, 用于呈现文档样式、数字、字体的元素。如果为 null,则将使用 reportContainer。).then((res) => {console.log("res---->", res);let bigBox = document.querySelector(".bigBox");let contractBox = document.getElementById("reportContainer");let st = window.getComputedStyle(contractBox, null);var tr = st.getPropertyValue("transform");if (tr === "none") {isScale.value = false;bigBox.style.height = "auto";const height = bigBox.offsetHeight;bigBoxHeight.value = height;} else {isScale.value = true;bigBox.style.height = "auto";const height = bigBox.offsetHeight * 0.5;bigBoxmargin.value = (window.innerWidth - 700 * 0.5) / 2;bigBoxHeight.value = height;}}).catch((err) => {console.log(err);// eslint-disable-next-lineElMessage({message: "网络问题,请刷新界面!",type: "error",});});}).catch((err) => {console.log(err);});

template

<template><div class="bigBox" :style="{ height: bigBoxHeight + 'px' }"><div id="reportContainer" :style="{ marginLeft: isScale ? bigBoxmargin + 'px' : 'auto' }"></div></div><div class="btnBox"><el-button type="primary" @click="showSign">前往签字</el-button></div><!-- 签字弹窗 --><sign v-if="signshow" :dialogVisible="signshow" @closeEvent="hideSign"></sign>
</template>

注意

1、这里的请求一定要加上 responseType: “arraybuffer”,

2、这里 bigBoxHeight 、bigBoxmargin 可以见我上一篇文章:前端实现签字效果+合同展示

http://www.hkea.cn/news/844541/

相关文章:

  • 深圳网站建设lxhd英文关键词seo
  • 在线购物商城网站百度移动端排名软件
  • 太原网站的公司友情链接的英文
  • 网站是用什么做的吗百度q3财报2022
  • 深圳福田网站建设公司如何做谷歌seo推广
  • 西安有做网站的吗北京网站设计公司
  • 哪家专门做特卖网站平台连接
  • 衢州网站推广最近发生的重大新闻
  • 网页设计的网站配色方案seo基础培训机构
  • 维护网站是什么工作淄博网站制作
  • 做电影下载网站成本淘宝关键词排名
  • 企业h5网站建设百度推广电话是多少
  • 中国保密在线网站培训系统软文怎么做
  • 山西住房城乡建设部网站整合网络营销是什么
  • 做美图网站有哪些东西吗个人博客seo
  • 南昌专业做网站公司竞价托管怎么做
  • 网站产品展示怎么做微信小程序建站
  • dw做网站的流程客户引流的最快方法是什么
  • 做网站app优惠活动的交换链接营销成功案例
  • 企业公示信息查询系统山西上海百度推广优化公司
  • 上海网站排名优化价格武汉百度快照优化排名
  • 做网站小程序如何做广告宣传与推广
  • 网站建设背景朝阳百度新闻网页
  • 专门做拼团的网站西安网站开发
  • 怎么看网站开发语言太原seo推广
  • 什么网站做宣传好新乡网站seo
  • 济南网站制作服务价格信息流优化师前景
  • 新手制作网站工具bt磁力猪
  • 怎么做网站系统深圳头条新闻
  • 北京网站设计公司新鸿儒seo公司的选上海百首网络