js生成word
js生成word
下载依赖
npm install html-docx-js
引入
import htmlDocx from 'html-docx-js/dist/html-docx';
代码
//参数 html 文件名字 下载完执行回调函数
function html2word (html,fileName,callback){
const converted = htmlDocx.asBlob(html);
const link = document.createElement('a');
link.href = URL.createObjectURL(converted);
link.download = fileName?fileName+'.docx':'document.docx';
link.click();
callback&&callback()
}
原文地址:https://blog.csdn.net/weixin_45673305/article/details/137872578
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!