62,068
社区成员
发帖
与我相关
我的任务
分享
<table id="PT" cellspacing="0" cellpadding="0" width="100%" border="1" bordercolorlight="#B6B6B6" bordercolordark="#FFFFFF" style="border-top-style: none; border-right-style: none; border-left-style: none; border-bottom-style: none;">
<colgroup id="ColSelected">
<col id="col1">
<col id="col2">
<col id="col3">
<col id="col4">
<col id="col5">
<col id="col6">
<col id="col7">
<col id="col8">
<col id="col9">
<col id="col10">
<col id="col11">
<col id="col12">
<col id="col13">
<col id="col14">
<col id="col15">
<col id="col16">
<col id="col17">
<col id="col18">
<col id="col19">
<col id="col20">
<col id="col21">
<col id="col22">
<col id="col23">
<col id="col24">
<col id="col25">
<col id="col26">
<col id="col27">
<col id="col28">
<col id="col29">
</colgroup>
.......//根据col列ID来实现隐藏显示列名
function AutomateExcel()
{
var oXL = new ActiveXObject("Excel.Application");
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var sel=document.body.createTextRange();
sel.moveToElementText(tid1);
sel.select();
sel.execCommand("Copy");
oSheet.Paste();
oXL.Visible =true;
oXL=null;
sel.execCommand("Unselect");
}
<table id="NewTableId" cellpadding="0" cellspacing="0" width="200%" border="0"><tr><td>
<table id="TT" cellspacing="0" cellpadding="0" width="100%" border="0" bordercolorlight="#B6B6B6" bordercolordark="#FFFFFF" style="border-top-style: none; border-right-style: none; border-left-style: none; border-bottom-style: none;">
<tr id="tt-1">
<td rowspan="4" style="width:15%;"> </td>
<td rowspan="4" colspan="16" align="right" style="width:70%;font-size: 24px; font-weight: bold;">2008年10月飞行监测城镇污水厂进、出水主要污染物浓度一览表</td>
</tr>
<tr id="tt0"><td> </td><td colspan="7"> </td><td colspan="7"> </td><td align="right"> </td>
<td align="right">单位:除含水率、色度、排污量、泥样、采样日期外均为mg/L</td></tr>
</table>
<table id="PT" cellspacing="0" cellpadding="0" width="100%" border="1" bordercolorlight="#B6B6B6" bordercolordark="#FFFFFF" style="border-top-style: none; border-right-style: none; border-left-style: none; border-bottom-style: none;">
<colgroup id="ColSelected">
<col id="col1">
<col id="col2">
<col id="col3">
<col id="col4">
<col id="col5">
<col id="col6">
<col id="col7">
<col id="col8">
<col id="col9">
<col id="col10">
<col id="col11">
<col id="col12">
<col id="col13">
<col id="col14">
<col id="col15">
<col id="col16">
<col id="col17">
<col id="col18">
<col id="col19">
<col id="col20">
<col id="col21">
<col id="col22">
<col id="col23">
<col id="col24">
<col id="col25">
<col id="col26">
<col id="col27">
<col id="col28">
<col id="col29">
</colgroup>
<tr align="center" id="tt1" bgcolor="#D4D4D4"><td rowspan="2" style="font-weight: bold;width:1%;">区域</td><td rowspan="2" style="font-weight: bold;">序号</td><td rowspan="2" style="font-weight: bold;">单位名称</td><td colspan="2" style="font-weight: bold;">BOD5</td><td colspan="2" style="font-weight: bold;">SS</td><td colspan="2" style="font-weight: bold;">CODcr</td><td colspan="2" style="font-weight: bold;">NH3-N</td><td colspan="2" style="font-weight: bold;">TP</td><td colspan="2" style="font-weight: bold;">PH</td><td colspan="2" style="font-weight: bold;">氨氮</td><td colspan="2" style="font-weight: bold;">总磷</td><td colspan="2" style="font-weight: bold;">总氮</td><td colspan="2" style="font-weight: bold;">色度(倍)</td><td rowspan="2" style="width:6%;: 宋体, 新宋体;font-weight: bold;">脱水污泥含水率(%)</td><td rowspan="2" style="width:6%;: 宋体, 新宋体;font-weight: bold;">排污量</td><td rowspan="2" style="width:6%;: 宋体, 新宋体;font-weight: bold;">泥样</td></tr>
<tr align="center" id="tt2" bgcolor="#D4D4D4"><td style="font-weight: bold;">进水</td><td style="font-weight: bold;">出水</td><td style="font-weight: bold;">进水</td><td style="font-weight: bold;">出水</td><td style="font-weight: bold;">进水</td><td style="font-weight: bold;">出水</td><td style="font-weight: bold;">进水</td><td style="font-weight: bold;">出水</td><td style="font-weight: bold;">进水</td><td style="font-weight: bold;">出水</td><td style="font-weight: bold;">进水</td><td style="font-weight: bold;">出水</td><td style="font-weight: bold;">进水</td><td style="font-weight: bold;">出水</td><td style="font-weight: bold;">进水</td><td style="font-weight: bold;">出水</td><td style="font-weight: bold;">进水</td><td style="font-weight: bold;">出水</td><td style="font-weight: bold;">进水</td><td style="font-weight: bold;">出水</td><td style="font-weight: bold;">进水</td><td style="font-weight: bold;">出水</td></tr>
//此处需要判断的地方---
</table>
the_table="上面的字符串";
function exp_tab(the_table)
{
var the_content="";
document.onclick();
the_content=the_table;
var newwin=window.open("about:blank","_blank","");
newwin.document.open();
newwin.document.write(the_content);
newwin.document.close();
newwin=null;
}
function AutomateExcel()
{
var oXL = new ActiveXObject("Excel.Application");
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var sel=document.body.createTextRange();
sel.moveToElementText(NewTableId);
sel.select();
sel.execCommand("Copy");
oSheet.Paste();
oXL.Visible =true;
oXL=null;
sel.execCommand("Unselect");
}
exp_tab(the_table);
AutomateExcel();
window.close();