如何使用php下载表格数据作为Excel表格?

时间:2022-09-15 21:13:05

Guys i'm generating a set of data in a table after som set of calculation.. as soon as user clicks save button excel file with that data must be generated for downloading..

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

What is the php code for that ..

这是什么PHP代码..

guys the data is not retrieved from database...its being displayed after a set of calculation as been performed.

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

Since i dont have any idea ive not posted any related code...sry for that..

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

below is how my table looks like

下面是我的表格的样子

https://ibb.co/mUMOrQ

below is my table code

下面是我的表格代码

       <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 -->   

Below is jquery that ive included to download the file

下面是我下载文件的jquery

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

1 个解决方案

#1