Node reading docx garbled code

H⃰U⃰A⃰ 2021-09-15 09:16:48
const fs = require("fs");
const AdmZip = require('adm-zip'); // Import view zip Package of files
let chooser = document.getElementById("readFile");
chooser.addEventListener("change", function (evt) {
let filePath = this.value.toString();
document.querySelector("p").innerHTML = " Read file from " + filePath;
const zip = new AdmZip(filePath); //filePath Is the file path
let contentXml = zip.readAsText("word/document.xml");// take document.xml Read as text Content ;
let str = "";
contentXml.match(/<w:t>[\s\S]*?<\/w:t>/ig).forEach((item)=>{
str += item.slice(5,-6)}
);
console.log(str)
})

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.

I think it's helpful for you to like it in the upper right corner ~

node Read docx The code problem _node

Scan the QR code above for my subscription number ~
Please bring the original link to reprint ,thank
Similar articles

2021-09-15

2021-09-15