将HTML转换为docx格式
使用html-docx-js-typescript可以轻松将HTML文档转换为docx格式,支持node.js和浏览器环境,包括vue / react / angular。 示例代码演示了Vue.js的用法:
import { asBlob } from 'html-docx-js-typescript'
import { saveAs } from 'file-saver'
const htmlString = `<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> Hello, world!
</body> </html>`
const docx = asBlob(htmlString)
saveAs(docx, 'document.docx')
63.24KB
文件大小:
评论区