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

做php网站濮阳网直播

做php网站,濮阳网直播,王野摩托,网站后台管理需求文章目录 mammothdocx4js mammoth 官网地址#xff1a;https://github.com/mwilliamson/mammoth.js#readme 安装mammoth#xff1a; npm i mammoth -S我们可以安装mammoth来实现上传的word文件的在线预览#xff0c;我们以element的上传组件为示例#xff1a; temp… 文章目录 mammothdocx4js mammoth 官网地址https://github.com/mwilliamson/mammoth.js#readme 安装mammoth npm i mammoth -S我们可以安装mammoth来实现上传的word文件的在线预览我们以element的上传组件为示例 templatedivel-upload classupload-demo drag action# :auto-uploadfalse :on-changechangeFileel-icon classel-icon--uploadupload-filled //el-icondiv classel-upload__textDrop file here or emclick to upload/em/divtemplate #tipdiv classel-upload__tipjpg/png files with a size less than 500kb/div/template/el-uploaddiv v-htmlwordcontent/div/div /template script langts setup import { ref } from vue import type { UploadProps } from element-plus import mammoth from mammothconst wordcontent ref()const changeFile: UploadProps[onChange] (uploadFile, uploadFiles) {const file uploadFile.rawconst myReader new FileReader()myReader.readAsArrayBuffer(file as Blob)myReader.addEventListener(loadend, function (e) {const buffer e?.target?.result // arraybuffer objectmammoth.convertToHtml({arrayBuffer: buffer}).then(function (result: { value: string; messages: any[] }) {const html result.value // The generated HTMLconst messages result.messages // Any mesarnings during conversionwordcontent.value html}).done()}) } /script 详细的API参考官网地址。 docx4js 官网地址https://github.com/lalalic/docx4js 使用docx4js实现获取docx文件有多少页码。 安装docx4js npm i docx4js -S我们新建一个docx.mjs,代码如下 import docx4js from docx4js import { TextDecoder } from utildocx4js.docx.load(./test2.docx).then((doc) {const propsAppRaw doc.parts[docProps/app.xml]._data.getContent()const propsApp new TextDecoder(utf-8).decode(propsAppRaw)console.log(propsApp)const match propsApp.match(/Pages(\d)\/Pages/)if (match match[1]) {const count Number(match[1])console.log(count)} })执行命令 node docx.mjs 可以在控制台看到打印结果,第一个打印 ?xml version1.0 encodingUTF-8 standaloneyes? Properties xmlnshttp://schemas.openxmlformats.org/officeDocument/2006/extended-properties xmlns:vthttp://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypesTemplateNormal.dotm/TemplatePages4/PagesWords996/WordsCharacters1013/CharactersLines0/LinesParagraphs0/ParagraphsTotalTime0/TotalTimeScaleCropfalse/ScaleCropLinksUpToDatefalse/LinksUpToDateCharactersWithSpaces1250/CharactersWithSpacesApplicationWPS Office_12.1.0.18543_F1E327BC-269C-435d-A152-05C5408002CA/ApplicationDocSecurity0/DocSecurity/Properties第二个打印 4其中的4表示这个word文档是4页。 但是有时候有的word文档解析的结果是不一样的如下 ?xml version1.0 encodingUTF-8 standaloneyes? ap:Properties xmlns:vthttp://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes xmlns:aphttp://schemas.openxmlformats.org/officeDocument/2006/extended-properties/该文件中就没有包含Pages的字段。 所以综上所示如果通过docx4js获取word文件的页码数量是不准确的并且需要在node环境中运行且文件是docx格式的doc格式的不支持。
http://www.yayakq.cn/news/2319/

相关文章:

  • 服装商城的网站策划书石家庄电子商务网站建设
  • 网站设计与网页制作wordpress qq空间
  • 临汾外贸网站建设价格网页设计考试
  • 个人网站备案 网站服务内容小说网站怎么做防采集
  • 网站常用的一种js的图片幻灯片特效代码企业展厅设计内容
  • 申通e物流的网站建设做网站推广复杂吗
  • 网站建设需要哪些资料admin登录网站
  • 免费素材网站排行榜wordpress audio player 下载
  • 提供手机网站开发广州白云机场网站建设
  • 路由器 东莞网站建设公司网站建设包括哪些东西
  • 网站开发怎么用自己的电脑网站设计的主要机构有哪些
  • 做像百姓网这样网站多少钱大学生兼职网站建设策划书
  • 新网站如何被快速收录网站建设培训报名
  • 小城市做网站随州网站建设便宜
  • 做旅游的网站的需求静态企业网站模板下载
  • 网站建设要写代码吗站长素材网
  • 宠物医疗设计素材网站用个人免费空间快速建立个人网站后方平台
  • 小企业网站建设在哪里wordpress 评论ip拉黑
  • 网站上的代码网页怎么做的智慧团建pc端官网
  • php开源订单管理系统杭州seo薪资水平
  • 中山市建设局安全监督站网站江苏建设人才无纸化考核网站
  • 做任务反佣金的网站wordpress 仿简书
  • 网站没被收录上海做建材上什么网站好
  • 公司营业执照可以做几个网站wordpress 忘记用户名密码
  • 网站由什么构成游戏app软件开发多少钱
  • 网站建设运维合同怎么做网页作业
  • 马鞍山专业网站制作大连网页设计培训学校
  • 做外贸兼职的网站设计软件开发工程师的就业前景
  • 深圳网站营销推广公司营销型网站重要性
  • 网站开发文档范例国信网络模版网站建设方案相关