<script>
function AllAreaWord() 
{
  if(document.all("tab").rows.length==0)
  {
   alert("没有内容可导!");
   return;
  }
  try{
   var oWD = new ActiveXObject("Word.Application"); 
  }catch(e)
  {
   alert("无法调用Office对象,请确保您的机器已安装了Office并已将本系统的站点名加入到IE的信任站点列表中!");
   return;
  }
var oDC = oWD.Documents.Add("",0,1); 
var oRange =oDC.Range(0,1); 
var sel = document.body.createTextRange(); 
sel.moveToElementText(tab); //tab 为导出数据所在的表格ID
sel.select(); 
sel.execCommand("Copy"); 
oRange.Paste();
oWD.ActiveDocument.ActiveWindow.View.Type=3 //设定显示为页面视图状态
oWD.Application.Visible = true; 
}
</script><table id="tab" align="center" width="300" border="1" bordercolor="#2baeff" cellpadding="0" cellspacing="0" bgcolor="lightblue">
  <Tr>
    <Td>1</td>
  </tr>
  <Tr>
    <Td>2</td>
  </tr>
  <Tr>
    <Td>3</td>
  </tr>
</table>
<input type=button name='button_export' title='导出到word'  onclick=AllAreaWord() value=下载到word> 各位老大,上边那段代码是导入指定表格到Word中,各位老大可以直接可以存为htm文件运行。现在它这个导出文档是把整个表格输出到一个文档中去了,如果内容太多,它会自己自动分到下一页。但是如果我是想遍历表格的行使它一行内容就占用一页文档要怎么做呢?比如说我想让上边的三行表格遍历后能够分别分为三页显示。
各位老大,我查了好资料,自己写遍历的代码试了试,不管怎么写都不行,只好来求助各位老大了~