
<!-- 路径写全 -->
<script type="text/javascript" src="./js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="./js/FileSaver.js"></script>
<script type="text/javascript" src="./js/jquery.wordexport.js"></script>
<button class="btn btn-primary" onclick="wordExport()">word导出</button>
<div id="wordExportDiv">
    <table>
        <thead>
            <tr>
                <th>aaaa</th>
                <th>bbbb</th>
                <th>cccc</th>
                <th>dddd</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>1111</td>
                <td>1111</td>
                <td>1111</td>
                <td><img src="1.PNG"/></td>
            </tr>
        </tbody>
    </table>
</div>
<script>
    function wordExport() {
        //选择性到处把不想导出的内容先隐藏掉
        $(".export,.btn-group").attr("style", "display:none;");
        $(".fixed-table-pagination").attr("style", "display:none;");
        $("#wordExportDiv").wordExport('生成word文档');
        //导出后把刚才隐藏掉的东西放开
        $(".fixed-table-pagination").attr("style", "display:block;");
        $(".export,.btn-group").attr("style", "display:block;");
    }
</script>