第一种:(导出格式:csv、txt、excel、word、png)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>
<body>
    <div>
        <ul class="dropdown-menu">
            <li>
                <a onclick="$('#stats_datatable').tableExport({type:'csv',escape:'false',filename:'(2016-02-29_2016-03-06)'});" href="#">
                    导出格式-CSV
                </a>
            </li>
            <li>
                <a onclick="$('#stats_datatable').tableExport({type:'txt',escape:'false',filename:'(2016-02-29_2016-03-06)'});" href="#">
                    导出格式-TXT
                </a>
            </li>
            <li>
                <a onclick="$('#stats_datatable').tableExport({type:'excel',escape:'false',filename:'(2016-02-29_2016-03-06)'});" href="#">
                    导出格式-Excel
                </a>
            </li>
            <li>
                <a onclick="$('#stats_datatable').tableExport({type:'doc',escape:'false',filename:'(2016-02-29_2016-03-06)'});" href="#">
                    导出格式-Word
                </a>
            </li>
            <li>
                <a onclick="$('#stats_datatable').tableExport({type:'png',escape:'false',filename:'(2016-02-29_2016-03-06)'});" href="#">
                    导出格式-PNG
                </a>
            </li>
        </ul>
    </div>
    <div class="panel-body">
        <table >
            <thead>
                <tr>
                    <th>名称</th>
                    <th>里程</th>
                    <th>次数</th>
                    <th>天数</th>
                    <th>签到</th>
                    <th>活动</th>
                    <th>时间周期</th>
                    <th>更新时间</th>
                </tr>
            </thead>
            <tbody></tbody>
        </table>
    </div>
    <!-- START SCRIPTS -->
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
    <!-- 数据表 -->

    <script src="js/tableExport.js"></script>
    <script src="js/mybase.js"></script>
    <script>
        $(function () {
            //=======让解码后中文不出现乱码的方法
            data = $.base64({ data: "已经编码过后的base64", type: 1, unicode: true });

            //=或
            data = $.base64({ data: "已经编码过后的base64", type: 1 });
            console.log(data);
            //downloadFile("myexcel.xls", data);
        });
    </script>
</body>
</html>
View Code

相关文章:

  • 2021-12-15
  • 2022-01-05
  • 2021-12-08
  • 2021-04-12
  • 2022-01-09
  • 2022-02-28
猜你喜欢
  • 2021-08-25
  • 2021-12-30
  • 2022-12-23
  • 2021-10-11
  • 2021-04-30
  • 2021-12-05
  • 2021-11-23
相关资源
相似解决方案