转自:http://www.lrsj.net/user1/4/archives/2007/287.html
js代码
<script language="javascript">


500)this.style.width=500;" align=top>function OpenWord(){
Layer1.style.border

ExcelSheet = new ActiveXObject('word.Application'); 
ExcelSheet.Application.Visible = true; 
var mydoc=ExcelSheet.Documents.Add('',0,1); 
myRange =mydoc.Range(0,1) 
var sel=Layer1.document.body.createTextRange() 
sel.select() 
Layer1.document.execCommand('Copy') 
sel.moveEnd('character') 
myRange.Paste(); 
location.reload() 
ExcelSheet.ActiveWindow.ActivePane.View.Type=9 
} 
html代码
<html>

<head>


<title>网页上内容导出到word</title> 
</head>
<body>
<div id="Layer1" >
<input type=button name='button_export' title='导出到word' onclick=OpenWord() value=下载到word></div> 
</div>


<Tr><Td>1</td><Td>2</td><Td>3</td></tr> 
<Tr><Td>4</td><Td>5</td><Td>6</td></tr> 
<Tr><Td>7</td><Td>8</td><Td>9</td></tr>

</body> </html> 























浙公网安备 33010602011771号