网页上内容导出到word里
2006-12-23 22:21
459 查看
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页上内容导出到word</title>
</head>
<body>
<div id="Layer1" >Happy New Year ! ! !
<input type=button name='button_export' title='导出到word' onclick=OpenWord() value=下载到word></div>
</div>
<p>this is a test!</p>
<table align="center" width="300" border="1" bordercolor="#2baeff" cellpadding="0" cellspacing="0" bgcolor="lightblue">
<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>
</table>
</body>
</html>
<script language="javascript">
function OpenWord(){
Layer1.style.border=0
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
}
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页上内容导出到word</title>
</head>
<body>
<div id="Layer1" >Happy New Year ! ! !
<input type=button name='button_export' title='导出到word' onclick=OpenWord() value=下载到word></div>
</div>
<p>this is a test!</p>
<table align="center" width="300" border="1" bordercolor="#2baeff" cellpadding="0" cellspacing="0" bgcolor="lightblue">
<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>
</table>
</body>
</html>
<script language="javascript">
function OpenWord(){
Layer1.style.border=0
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
}
</script>
相关文章推荐
- 网页内容使用JS导出为word文档
- 网页上内容导出到word里
- asp.net网页内容导出到word
- 网页上内容导出到word
- 网页内容导出word/excel的js代码
- 网页上内容导出到word里
- 网页内容导出word/excel的js代码
- 网页上内容导出到word里
- 网页上内容导出到word里
- 网页内容导出word文档jquery插件
- 网页上内容导出到word里
- 网页上内容导出到word里
- javascript Web页面内容导出到Word、Excel
- b/s 导出内容word中换行
- javascript下用ActiveXObject控件替换word书签,将内容导出到word后打印第1/2页
- 如何将网页文件导出到word中
- 网页导出成word文档的默认视图方式问题
- 网页内容使用JS导出为excel
- asp.net网页中导出EXCEL,WORD的环境设置验证实例
- JavaScript Web页面内容导出到Word、Excel