微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javascript – 如何使用php下载表数据作为excel表..?

伙计们,我在som计算集后在表格中生成一组数据.一旦用户点击保存按钮excel文件,必须生成该数据以供下载.

什么是PHP代码..

伙计们没有从数据库中检索数据……它是在执行了一组计算后显示的.

因为我没有任何想法我没有发布任何相关的代码… sry为此…

下面是我的表格的样子

https://ibb.co/mUMOrQ

下面是我的表格代码

       <div id="myModal" class="modal fade in">
    <div class="modal-dialog">
        <div class="modal-content">

            <div class="modal-header">
                <a class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span></a>
                <div class="table-title">
                <h3>CUF Table</h3>
                </div>
                <table class="table-fill" id="tabid">
                <thead>
            </div>

    <div class="modal-body">
        <tr>
        <th class="text-left">TimeStamp</th>
        <th class="text-left">CUF</th>
        </tr>
        </thead>
        <tbody class="table-hover">
        <!--tr>
        <td class="text-left" id="data"></td>
        <td class="text-left" id="data1"></td>
        </tr-->
        </tbody>
        </table>
    </div>

     <div class="modal-footer">
                <div class="btn-group">
                    <button id="change-chart"  class="btn btn-primary"><span class="glyphicon glyphicon-check"></span>Save</button>
                  </div>
      </div>
      </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->   

下面是我下载文件的jquery

     $("#BUTTON").click(function(){
     $("#TABLE").table2excel({
     // exclude CSS class
    exclude: ".noExl",
    name: "Data",
    filename: "Data" //do not include extension
   });
   });

解决方法:

您可以使用以下之一

https://stackoverflow.com/a/38761185/5350773

http://www.jqueryscript.net/table/Export-Html-Table-To-Excel-Spreadsheet-using-jQuery-table2excel.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐