如何使用javascript在excel单元格中设置超链接 excel单元格?!excel本身难道没有超级链接吗?O.0 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 解决方法应该和页面的思路差不多,在sheet的onload方法中加语句 <html xmlns:o="urn:schemas-microsoft-com:office:office"xmlns:x="urn:schemas-microsoft-com:office:excel"xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=GB2312"><script>function out(){ try{ var elTable = document.getElementById("out"); var oRangeRef = document.body.createTextRange(); oRangeRef.moveToElementText( elTable ); oRangeRef.execCommand( "Copy" ); var oXL = new ActiveXObject("Excel.Application") var oWB = oXL.Workbooks.Add ; var oSheet = oWB.ActiveSheet ; oSheet.Paste(); oSheet.Cells.NumberFormatLocal = "@"; oSheet.Columns("D:D").Select oXL.Selection.ColumnWidth = 20 //oSheet.Columns("A:A").Select //oSheet.Columns("A").Width = 1000; oSheet.Hyperlinks.Add(oSheet.Range("F14"), "http://www.sina.com.cn", "", "", "sina") oXL.Visible = true; oSheet = null; oWB = null; appExcel = null; }catch(e){alert(e.description)} }</script></head><body><table id ='out'> <tr> <td x:str bgcolor="#FF0000">00001</td> <td x:str>0002</td> </tr> <tr> <td height=18 align=right style='height:13.5pt' x:str>00001</td> <td align=right x:str>000002</td> </tr> <tr> <td x:str>0003</td> <td x:str>00003</td> </tr></table><INPUT type="button" value="Button" id=button1 name=button1 onclick="out()"></body></html> 不知这样可否:直接输入内容“<a href='http://www.163.com/'>内容1</a>”//汗,没试过。 求助:用javascript通过id控制显示div问题 如何获得填写后的value=1的值???? 修复ie6-position:fixed 节点属性/方法问题,在IE下出错,在Firefox下没错? 放大缩小与层的位置关系 Mozilla的严重问题,designMode引起事件失效 如何取得层的实际宽度而非窗口宽度? 日期时间问题,高分求解 怎样做两个一样大的TEXTAREA,右边的滚动,左边的也跟着滚? 如何控制frame的宽度? 网页以htm为后缀可以运行,而改成.aspx后则无法运行????? 点击按钮打开新窗口出错!
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40"><head>
<meta http-equiv=Content-Type content="text/html; charset=GB2312">
<script>
function out(){ try{
var elTable = document.getElementById("out");
var oRangeRef = document.body.createTextRange();
oRangeRef.moveToElementText( elTable );
oRangeRef.execCommand( "Copy" ); var oXL = new ActiveXObject("Excel.Application")
var oWB = oXL.Workbooks.Add ;
var oSheet = oWB.ActiveSheet ;
oSheet.Paste();
oSheet.Cells.NumberFormatLocal = "@";
oSheet.Columns("D:D").Select
oXL.Selection.ColumnWidth = 20 //oSheet.Columns("A:A").Select
//oSheet.Columns("A").Width = 1000;
oSheet.Hyperlinks.Add(oSheet.Range("F14"), "http://www.sina.com.cn", "", "", "sina") oXL.Visible = true;
oSheet = null;
oWB = null;
appExcel = null; }catch(e){alert(e.description)}
}</script>
</head><body><table id ='out'>
<tr>
<td x:str bgcolor="#FF0000">00001</td>
<td x:str>0002</td>
</tr>
<tr>
<td height=18 align=right style='height:13.5pt' x:str>00001</td>
<td align=right x:str>000002</td>
</tr>
<tr>
<td x:str>0003</td>
<td x:str>00003</td>
</tr>
</table>
<INPUT type="button" value="Button" id=button1 name=button1 onclick="out()">
</body>
</html>