html与excel转换

 <html> 
<head> 
 
<style type="text/css"> 
 
body {background-color: yellow}  
 
table {  
  width:400px;  
  border-collapse: collapse;  
  cellspacing:0;  
}  
td{  
 border: 1 solid black;  
}  
</style> 
 
</head> 
 
<body> 
<table> 
<tr> 
<td>&nbsp;  
</td> 
<td>&nbsp;  
</td> 
<td>&nbsp;  
</td> 
<td>&nbsp;  
</td> 
</tr> 
<tr> 
<td>&nbsp;  
</td> 
<td>&nbsp;  
</td> 
<td>&nbsp;  
</td> 
<td>&nbsp;  
</td> 
</tr> 
<tr> 
<td>&nbsp;  
</td> 
<td>&nbsp;  
</td> 
<td>&nbsp;  
</td> 
<td>&nbsp;  
</td> 
</tr> 
</table> 
 
 
</body> 
</html> 

将以上代码放入记事本中,然后把记事本后缀名修改为xls

 

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


</head>

<body link=blue vlink=purple>

<table x:str border=1 cellpadding=0 cellspacing=0 width=500 style='border-collapse:
 collapse;table-layout:fixed;width:375pt'>
 <col width=200 style='mso-width-source:userset;mso-width-alt:6400;width:150pt'>
 <col width=300 style='mso-width-source:userset;mso-width-alt:9600;width:225pt'>
 <tr height=19 style='mso-height-source:userset;height:14.25pt'>
  <td height=19 class=xl24 width=200 style='height:14.25pt;width:150pt'
  x:str="'20000" u1:num>20000</td>
  <td class=xl25 width=300 style='width:225pt'>hello</td>
 </tr>
 <tr height=19 style='height:14.25pt'>
  <td height=19 align=right style='height:14.25pt' x:num>3000</td>
  <td>world</td>
 </tr>
 <![if supportMisalignedColumns]>
 <tr height=0 style='display:none'>
  <td width=200 style='width:150pt'></td>
  <td width=300 style='width:225pt'></td>
 </tr>
 <![endif]>
</table>

</body>

</html>

加边框。可以控制不用COM组件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值