将列表导出为excel表格

来源:互联网 发布:mac pdf转word网页版 编辑:程序博客网 时间:2024/05/17 19:15

合并单元格

<script type="text/javascript">$(function(){               //trackTable为表格的id    for(var col=0;col<trackTable.rows[1].cells.length;col++){        $("#trackTable").rowspan(col);    }})//封装的一个JQuery小插件jQuery.fn.rowspan = function(colIdx) {         return this.each(function(){            var that;            $('tr', this).each(function(row) {                $('td:eq('+colIdx+')', this).filter(':visible').each(function(col) {                    if (that!=null && $(this).html() == $(that).html() && $(this).html() != '&nbsp;' && $(that).html() != '&nbsp;') {                        rowspan = $(that).attr("rowSpan");                        if (rowspan == undefined) {                            $(that).attr("rowSpan",1);                            rowspan = $(that).attr("rowSpan"); }                            rowspan = Number(rowspan)+1;                            $(that).attr("rowSpan",rowspan);                            $(this).hide();                        } else {                            that = this;                        }                    });                });            });          }</script>

注:本篇跟其他帖子有雷同的地方,我只是借用并修改,望原作者理解