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

广州网站建设外包建设推广海棠网站

广州网站建设外包建设推广,海棠网站,ug编程培训,vps 做网站提示#xff1a;word预览方式—插件 文章目录 [TOC](文章目录) 前言一、vue-office-docx把docx转换html二、调取window.print三、print-js四、vue-print-nb总结 前言 word预览 一、vue-office-docx把docx转换html npm install vue-office-docx -S-DofficeDocx.vue templ… 提示word预览方式—插件 文章目录 [TOC](文章目录) 前言一、vue-office-docx把docx转换html二、调取window.print三、print-js四、vue-print-nb总结 前言 word预览 一、vue-office-docx把docx转换html npm install vue-office-docx -S-DofficeDocx.vue templatediv classpreview_boxVueOfficeDocx :srchtmlContent/VueOfficeDocx/div/templatescriptimport axios from axiosimport VueOfficeDocx from vue-office/docx//引入相关样式import vue-office/docx/lib/index.css;export default {name: preview,components:{VueOfficeDocx},data () {return {src:.docx文件rul,htmlContent:}},mounted(){this.docToHtml();},methods: {docToHtml(){axios.get(this.src,{ responseType: arraybuffer }).then((res){this.htmlContent res.data;})}}}/scriptstyle scoped/style 样式还原度一般间距太大分页也有问题 二、调取window.print officeDocx.vue templatediv classpreview_box div classpreview_print_btn clickprintHTML打印/divdiv refprintBoxRefVueOfficeDocx :srchtmlContent/VueOfficeDocx/div/div/templatescriptimport axios from axiosimport VueOfficeDocx from vue-office/docx//引入相关样式import vue-office/docx/lib/index.css;export default {name: preview,components:{VueOfficeDocx},data () {return {src:https://iteachcdn.test.xdf.cn/doc/111f92d3d71f471db47a4cb88b425d71.docx,// src:.docx文件rul,htmlContent:}},mounted(){this.docToHtml();},methods: {docToHtml(){axios.get(this.src,{ responseType: arraybuffer }).then((res){this.htmlContent res.data;})},printHTML(){// 新建窗口const win window.open(,_blank);// 把要打印的html写入新窗口win.document.write(this.$refs.printBoxRef.innerHTML);// 调起浏览器打印win.window.print();// 关闭新窗口win.window.close(); },}}/script style scoped .preview_print_btn{height: 32px;line-height: 32px;background: #0e7a38;color: #fff;text-align: center; } /style预览有问题打印也有问题 三、print-js npm install print-js -S-DofficeDocx.vue templatediv classpreview_box div classpreview_print_btn clickprintHTML打印/divdiv refprintBoxRefVueOfficeDocx :srchtmlContent/VueOfficeDocx/div/div/templatescriptimport axios from axiosimport VueOfficeDocx from vue-office/docx//引入相关样式import vue-office/docx/lib/index.css;import printJS from print-jsexport default {name: preview,components:{VueOfficeDocx},data () {return {src:https://iteachcdn.test.xdf.cn/doc/111f92d3d71f471db47a4cb88b425d71.docx,// src:.docx文件rul,htmlContent:}},mounted(){this.docToHtml();},methods: {docToHtml(){axios.get(this.src,{ responseType: arraybuffer }).then((res){this.htmlContent res.data;})},printHTML(){printJS({printable: this.$refs.printBoxRef,type: html,targetStyles: [*]}); },}}/script style scoped .preview_print_btn{height: 32px;line-height: 32px;background: #0e7a38;color: #fff;text-align: center; } /style打印样式相对好一些但是分页有问题 四、vue-print-nb npm install vue-print-nb -S-DofficeDocx.vue templatediv classpreview_box div classpreview_print_btn v-printprintobj打印/divdiv idprintBox refprintBoxRefVueOfficeDocx :srchtmlContent/VueOfficeDocx/div/div/templatescriptimport axios from axiosimport VueOfficeDocx from vue-office/docx//引入相关样式import vue-office/docx/lib/index.css;import Print from vue-print-nb;export default {name: preview,components:{VueOfficeDocx},data () {return {src:.docx文件rul,htmlContent:,printobj: {id: printBox,popTitle: 标题,extraCss: https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css,extraHead: meta http-equivcontent-language contentzh-cn /,beforeOpenCallback(vue) {console.log(调起打印弹窗之前);},openCallback(vue) {console.log(调起打印弹窗);}}}},directives: { Print },mounted(){this.docToHtml();},methods: {docToHtml(){axios.get(this.src,{ responseType: arraybuffer }).then((res){this.htmlContent res.data;})},}}/script style scoped .preview_print_btn{height: 32px;line-height: 32px;background: #0e7a38;color: #fff;text-align: center; } media print {page {size: auto;margin: 3mm;}body {height: auto;} } /style打印样式也有问题 综上word转html后进行打印方式存再问题不建议使用 总结 踩坑路漫漫长~
http://www.hkea.cn/news/14344565/

相关文章:

  • 做公司网站,哪个程序用的多阿里云建站文章搜索
  • 做网站 收费广州新塘网站建设推广公司
  • 网站网页设计怎样wordpress 下拉菜单插件
  • 外贸网站源码下载域名 就一个网站
  • 郑州房地产网站建设小荷作文网
  • 北仑网站制作企业馆
  • 百度网站开发语言温州网站策划
  • 镇海区建设交通局网站进不去了教育培训平台
  • 答题网站开发教程抖音代运营怎么样
  • 公司网站建设计入什么科目国家市场监督局官网入口
  • 在dw里如何做网站wamp做的网站上传
  • 网站做竞价河北城乡建设部网站首页
  • 通过域名打开网站是做映射么华为云 搭建网站
  • 无忧网站建设网页设计网站模板网站建设网页模板下载
  • 企业网站建设常见问题昆山网站网站建设
  • iis 无法访问此网站网址域名注册信息查询
  • 360如何做免费的网站wordpress模板在哪
  • 山西建设机械网站seo优化团队
  • 备案编号不放在网站检查wordpress主题
  • wordpress网站关键字创建信息平台的方法
  • 门户网站建站齐齐哈尔市建设工程监察网站
  • 深圳优质网站建设案例高端网站设计官网
  • 杭州设计企业网站高端公司沈阳京科妇科医院
  • 石家庄青园网站建设wordpress通过电子邮件
  • 怎么做网站推广方案凡科网站代理登录入口
  • 专业外贸制作网站wordpress社交媒体插件
  • 模板包下载网站永修建设局网站
  • 临海高端营销型网站建设地址佛山网络推广哪里好
  • 陈塘庄网站建设哪个网站可以代做软件
  • 免费软件网站下载教务系统管理系统