将jsp页面中table导出到doc

<SCRIPT LANGUAGE="javascript">

//指定页面区域内容导入Word

function AllAreaWord() {

var oWD = new ActiveXObject("Word.Application");

var oDC = oWD.Documents.Add("",0,1);

var oRange =oDC.Range(0,1);

var sel = document.body.createTextRange();

sel.moveToElementText(PrintA);

sel.select();

sel.execCommand("Copy");

oRange.Paste();

oWD.Application.Visible = true;

//window.close();

}

</SCRIPT>

应用举例:

<table width="100%" align=center border="0" cellpadding="0" cellspacing="0" id = "PrintA">

<tr><td>…</td></tr>

</table>

你可能感兴趣的:(JavaScript,jsp)