• 微信号:Zh-y9213
您当前的位置:爱资源分享网 > > 网站源码 > 网站制作

利用wordexport插件将内容转换word文档教程

栏目:网站制作时间:2022-07-26 00:12阅读数:48人阅读

1、首先下载wordexport的js,下载地址:

https://GitHub.com/eligrey/FileSaver.js/

https://github.com/markswindoll/jQuery-Word-Export

2、然后在需要转换的页面引入jquery 和FileSaver.js

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/FileSaver.js"></script>
<script type="text/javascript" src="js/jquery.wordexport.js"></script>

3、在需要转换的内容的DIV上加上ID

<div id="export-content">Your content here</div>

4、创建一个导出的按钮例如:

<a class="btn jquery-word-export" href="javascript:void(0)">导出为.doc文档</a>

5、最后加上事件JS代码

<script type="text/javascript">
jQuery(document).ready(function($) {
    $("a.jquery-word-export").click(function(event) {
        $("#pagecontent").wordExport();
    });
});
</script>



资源均来自第三方,谨慎下载,前往第三方网站下载

本站所有文章、数据、图片均来自互联网,一切版权均归源网站或源作者所有。

如果侵犯了你的权益请来信告知我们删除。邮箱:737597453@qq.com