核心javascript代码
<script type="text/javascript">
function bringtoexcel(){
var pastetext="全部统计表 ";
pastetext=pastetextdocument.all.excelbiao.innerhtml;
window.clipboarddata.setdata ("text", pastetext);
var oxl = new activexobject("excel.application");
oxl.visible = true;
var owb = oxl.workbooks.add();
var osheet = owb.activesheet;
osheet.paste();
oxl.visible = true;
oxl.usercontrol = true;
}
//导出word
function openword2(){
excelsheet = new activexobject('word.application');
excelsheet.application.visible = true;
var mydoc=excelsheet.documents.add('',0,0);
myrange =mydoc.range(0,1);
myrange =mydoc.range(myrange.end-1,myrange.end);//设定起始点
var sel=document.body.createtextrange();
sel.movetoelementtext(aoutword);//设置要导出的表格名称
sel.select();
document.execcommand('copy');
sel.moveend('character');
myrange.paste();
myrange =mydoc.range(myrange.end-1,myrange.end);
myrange.insertafter("\n");
excelsheet.activewindow.view.tablegridlines = false;
}
script>
具体看附件