网页内容使用JS导出为word文档
2009-04-20 14:19
871 查看
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页上内容导出到word</title>
<script language="javascript">
function OpenWord(){
//Layer1.style.border=0
word = new ActiveXObject('Word.Application');
word.Application.Visible = true;
var mydoc=word.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()
word.ActiveWindow.ActivePane.View.Type=9
}
</script>
</head>
<body>
<div id="Layer1" >EKING
<input type=button name='button_export' title='导出到word' onclick="OpenWord()" value="导出到word">
</div>
<p>测试导出--javascript</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>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页上内容导出到word</title>
<script language="javascript">
function OpenWord(){
//Layer1.style.border=0
word = new ActiveXObject('Word.Application');
word.Application.Visible = true;
var mydoc=word.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()
word.ActiveWindow.ActivePane.View.Type=9
}
</script>
</head>
<body>
<div id="Layer1" >EKING
<input type=button name='button_export' title='导出到word' onclick="OpenWord()" value="导出到word">
</div>
<p>测试导出--javascript</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>
相关文章推荐
- 网页内容导出word文档jquery插件
- 网页内容使用JS导出为excel
- Java 使用Freemarker导出word 文档,解决当一段内容中既有文字又有图片的问题
- 网页内容导出word/excel的js代码
- 网页内容导出word/excel的js代码
- 使用js实现页面导出到word文档
- JS获取word文档内容到html页面
- js将html中的内容导出word、或者excel文件的方法
- 将网页内容转换成word或excel文档的方法(c#.net)
- 网页上内容导出到word里
- 网页导出成word文档的默认视图方式问题
- 巧用Word - 在Word中使用下拉菜单控制文档的可视内容
- 巧用Word - 在Word中使用下拉菜单控制文档的可视内容
- 使用itext导出word文档
- ie浏览器使用js导出网页到excel并打印
- 使用js将页面导出为word的简洁方法
- c#.net 将网页内容转换成word或excel文档
- 使用POI读取word文档内容
- 使用freemarker按模板导出带表格word文档
- 使用freemarker导出word文档包含多张图片