【发布时间】:2019-07-26 07:35:12
【问题描述】:
我需要阅读 .doc 文件,更改一些属性并保存它。我该怎么做?
我可以读取 .docx 文件,如下所示:
const zip = new AdmZip(filePath);
const xml = zip.readAsText('word/document.xml');
console.log(xml)
//<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
//<w:document //xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessi//ngCanvas" //xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" //xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chart//ex...
我尝试像这样阅读 .doc:
const expectedXml = fs.readFileSync(filePath);
但我得到了不分青红皂白的结果。
我希望得到 .docx 示例中的 xml。
【问题讨论】:
标签: node.js xml parsing docx doc