js导出word例子.doc
文本预览下载声明
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html
head
base href=:9009/edm/
title工程文档借阅申请单/title
meta http-equiv=pragma content=no-cache
meta http-equiv=cache-control content=no-cache
meta http-equiv=expires content=0
meta http-equiv=keywords content=keyword1,keyword2,keyword3
meta http-equiv=description content=This is my page
link rel=stylesheet type=text/css href=css.css
script type=text/javascript src=js/main.js/script
script type=text/javascript
function ExportToWord(){
alert(导出word文档,请保存);
var cu=document.getElementById(div1);
var curTbl = document.getElementById(exprotT);
var word = new ActiveXObject(Word.Application);
word.visible = true ;
//word.DisplayAlerts = false;
//创建AX对象wrod
var range = word.Documents.add();
//获取workbook对象
var sel = document.body.createTextRange();
sel.moveToElementText(cu);
sel.moveToElementText(curTbl);
//把表格中的内容移到TextRange中
sel.select();
//全选TextRange中内容
sel.execCommand(Copy);
//复制TextRange中内容
range.Content.Paste();
//粘贴到活动的EXCEL中
}
/script
/head
body
div class=tab_03_title id=div1工 程 文 档 借 阅 申 请 单/div
!--startprint--
div class=tab_03_tab
table width=98% height=258 border=1 cellpadding=0 cellspacing=0 class=tab id=exprotT
tr
td class=tab_03_gridCell width=17%借阅人姓名/td
td class=tab_03_gridCell王帅/td
td class=tab_03_gridCell width=17%所在单位/td
td class=tab_03_gridCell招标模块/td
/tr
tr
td class=tab_03_gridCell联系电话/td
td class=tab_03_gridCeltd
td class=tab_03_gridCell借阅日期/td
td class=tab_03_gridCell2011-02-28/td
/tr
tr
td class=tab_03_gridCell借阅期限/td
td class=tab_03_gridCell colspan=3天/td
/tr
tr
td class=tab_03_gridCell借阅资料/td
td class=tab_03_g
显示全部