文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>脚本导出datagird/gridview数据

脚本导出datagird/gridview数据

时间:2010-12-17  来源:jasonC

            var oControlRange = document.body.createControlRange();
            oControlRange.add(tempTable,0);                
            oControlRange.select();
            document.execCommand("Copy");
           
            document.body.removeChild(tempTable);

            var xls;
            try
            {
                xls = new ActiveXObject( "Excel.Application" );
            }
            catch(e)
            {
                ShowHtmlString("提示","<div style='padding:15px;'>你的浏览器设置不正确或Excel没有安装!<br />请启用Active控件和插件.<br />可以点击以下链接查看参考设置步骤:<br /><a href='ActiveX.htm' target='_blank'>ActiveX设置说明</a></div>",330,120);
                return false;
            }

            xls.visible = true;
            var xlBook = xls.Workbooks.Add;
            var xlsheet = xlBook.Worksheets(1);
            xlBook.Worksheets(1).Activate;
            xlsheet.Paste;
            xls=null;
        }   
       
        //Add by bisdev01(luqingfei)#2010-11-19 只保留文字资料,删除input,image,以及隐藏的元素
        function removeHiddenElement(parentElement)
        {
            if (parentElement != null)
            {
                for(var i=parentElement.children.length-1; i >= 0; i--)
                {
                    var cld = parentElement.children(i);
                    if (cld.tagName.toLowerCase() == "input"
                        || cld.tagName.toLowerCase() == "img" )
                    {
                        parentElement.removeChild(cld);
                        continue;
                    }
                   
                    if (cld.style.display.toLowerCase() == "none")
                    {
                        parentElement.removeChild(cld);
                        continue;
                    }
                   
                    cld.style.color = "black";
                   
                    if (cld.children.length > 0)
                    {
                        removeHiddenElement(cld);
                    }
                }
            }
        }

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载