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

javascript: Converts HTML documents to DOCX in the browser

Convert Word documents (.docx files) to HTML
https://www.npmjs.com/package/mammoth/v/1.11.0?activeTab=code
https://github.com/mwilliamson/mammoth.js

HTML to DOCX converter
https://github.com/TurboDocx/html-to-docx
https://phppot.com/javascript/how-to-export-html-to-word-document-with-javascript/
https://dev.to/jsstampede/embed-html-into-word-documents-with-docxjs-the-easy-way-2n6a
https://www.convertapi.com/html-to-docx/javascript
https://github.com/ConvertAPI/convertapi-library-js TypeScript
https://www.e-iceblue.com/Tutorials/Doc-JavaScript/React/Convert-HTML-to-Word-with-JavaScript-in-React.html
https://evidenceprime.github.io/html-docx-js/

 

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>How to Export HTML to Word Document with JavaScript</title>
<style>
body {width: 550px;font-family: Arial;line-height: 25px;
}#btn-export {background: #484848;color: #FFF;border: #000 1px solid;padding: 10px 20px;font-size: 12px;border-radius: 3px;
}.content-footer {text-align: center;
}
.source-html-outer {border: #d0d0d0 1px solid;border-radius: 3px;padding: 10px 20px 20px 20px;
}
</style>
</head>
<body>
<div class="source-html-outer"><div id="source-html"><h1><center>Artificial Intelligence</center></h1><h2>Overview</h2><p>Artificial Intelligence(AI) is an emerging technologydemonstrating machine intelligence. The sub studies like <u><i>NeuralNetworks</i>, <i>Robatics</i> or <i>Machine Learning</i></u>are the parts of AI. This technology is expected to be aprime part of the real world in all levels.</p></div><div class="content-footer"><button id="btn-export" onclick="exportHTML();">Export to worddoc</button></div>
</div><script>function exportHTML(){var header = "<html xmlns:o='urn:schemas-microsoft-com:office:office' "+"xmlns:w='urn:schemas-microsoft-com:office:word' "+"xmlns='http://www.w3.org/TR/REC-html40'>"+"<head><meta charset='utf-8'><title>Export HTML to Word Document with JavaScript</title></head><body>";var footer = "</body></html>";var sourceHTML = header+document.getElementById("source-html").innerHTML+footer;var source = 'data:application/vnd.ms-word;charset=utf-8,' + encodeURIComponent(sourceHTML);var fileDownload = document.createElement("a");document.body.appendChild(fileDownload);fileDownload.href = source;fileDownload.download = 'document.doc';fileDownload.click();document.body.removeChild(fileDownload);}
</script>
</body>
</html>

  

 

http://www.zskr.cn/news/117437.html

相关文章:

  • 基于UWB定位的安全帽人员定位系统:技术架构和核心功能详解
  • Gurobi 重磅回归GAMS与GAMSPy
  • 再次紧急修复,Flutter 针对 WebView 无法点击问题增加新的快速修复
  • 学生管理系统源码 Python+Django+Vue 前后分离 设计文档
  • 【即插即用模块】SCI1区 IF 15.5!| 空间注意力融合模块聚合结构细节,跨注意力融合模块捕捉全局语义,兼顾细粒度与上下文!SCI保二区争一区!彻底疯狂!!!
  • 16、Linux 中 IPX 与 NCP 文件系统的使用与配置
  • iOS 18.1 - iOS 26.x 抢先开启国行 Ai、分屏,Misaka26 工具来袭!!!!! - 指南
  • 【即插即用模块】SCI1区 | CNN为什么不能捕获长距离特征?双坐标注意力牛在哪:平均+最大池化并行,涨点必备,SCI保二区争一区!彻底疯狂!!!
  • langfuse 使用
  • 基于大数据的交通信号智能控制系统的设计与实现任务书
  • 17、Taylor UUCP 配置与使用指南
  • 18、Linux 电子邮件管理全解析
  • 收藏!程序员转型大模型:不是从零开始,而是降维升级
  • Git入门学习
  • NVIDIA正式推出Nemotron 3:用开放模型重塑AI多智能体时代
  • 为什么越来越多跨境卖家从平台转向独立站?
  • SC4D50120H-JSM 碳化硅肖特基二极管
  • 【强烈推荐】LangGraph核心概念解析:State管理+实战案例,一篇搞定大模型开发
  • 第11讲 蓝牙模块与建议数据包解析
  • 揭秘知识图谱与大模型的黄金组合,解决大模型幻觉问题的实战指南!
  • SpringBean生命周期,动态代理
  • 2*8的lcd显示屏自动居中
  • 几种不同的技师展示、推荐形式,每个客户一上来就能找到喜欢的技师,立刻下单!
  • 基于大数据的餐饮食材管理系统的设计与实现开题报告
  • 基于SpringBoot的鸟博士微信小程序设计与实现(程序+文档+讲解)
  • 基于大模型LLM的开发与编程教程
  • Android-Audio-为啥不移到packages/module
  • 2025 OA 选型关键看这 4 点:集成、灵活、安全、易用,附高性价比系统清单
  • Flink startNewChain 核心解析
  • 41、深入探究Linux文件共享与编程开发