<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script>
function wordcontorl(){
var WordApp=new ActiveXObject("Word.Application");   
  
var wdCharacter=1   ;
var wdOrientLandscape = 1   ;
WordApp.Application.Visible=true;   
var myDoc=WordApp.Documents.Add();   
 
WordApp.ActiveDocument.PageSetup.Orientation = wdOrientLandscape   ;//设置为横版
  /*
WordApp.Selection.ParagraphFormat.Alignment=1; //1居中对齐,0为居右   
WordApp.Selection.Font.Bold=true  ;
WordApp.Selection.Font.Size= 20;  
WordApp.Selection.TypeText("我的标题");   

WordApp.Selection.MoveRight(wdCharacter);    //光标右移字符   
WordApp.Selection.TypeParagraph();         //插入段落 相当于br   
WordApp.Selection.Font.Size=12;  
WordApp.Selection.TypeText("副标题"); //分行插入日期    
*/
//表单区域
WordApp.Selection.TypeParagraph();        //插入段落 
WordApp.Selection.Font.Bold=false  ;
WordApp.Selection.Font.Size= 11 ;

//selection.Font.color = 16737846;//设置字体格式   
var tableform=myDoc.Tables.Add (WordApp.Selection.Range, 6,8) //8行7列的表格
tableform.Cell(1,2).Merge( tableform.Cell(1,8) ); //合并某个单元格
tableform.Cell(3,1).Merge( tableform.Cell(3,2) ); 
tableform.Cell(3,2).Merge( tableform.Cell(3,4) ); 
tableform.Cell(3,3).Merge( tableform.Cell(3,5) ); 
tableform.Cell(4,1).Merge( tableform.Cell(4,2) ); 
tableform.Cell(4,2).Merge( tableform.Cell(4,4) ); 
tableform.Cell(4,3).Merge( tableform.Cell(4,5) ); 
tableform.Rows(5).Cells.Merge();
tableform.Rows(6).Cells.Merge();
tableform.Cell(1,1).range.Text="标题";
tableform.Cell(1,2).range.Text="签呈文档测试数据";
tableform.Cell(2,1).range.Text="文号";
tableform.Cell(2,2).range.Text="222";
tableform.Cell(2,3).range.Text="承办单位";
tableform.Cell(2,4).range.Text="长沙市纪委";
tableform.Cell(2,5).range.Text="经办人";
tableform.Cell(2,6).range.Text="程可庆";
tableform.Cell(2,7).range.Text="日期";
tableform.Cell(2,8).range.Text="2010-09-17";
tableform.Cell(3,1).range.Text="批示意见";
tableform.Cell(3,2).range.Text="审核意见";
tableform.Cell(3,3).range.Text="初核意见";
tableform.Cell(4,1).range.Text="同意";
tableform.Cell(4,2).range.Text="同意";
tableform.Cell(4,3).range.Text="同意";
tableform.Cell(5,1).range.Text="内容提要及承办意见人";
tableform.Cell(6,1).range.Text="同意";

tableform.Rows(1).Height="25";
tableform.Rows(2).Height="20";
tableform.Rows(3).Height="20";
tableform.Rows(4).Height="130";
tableform.Rows(5).Height="20";
tableform.Rows(6).Height="130";
tableform.Cell(1,1).Width="2";
tableform.Cell(1,2).Width="20";
tableform.Cell(2,1).Width="2";
tableform.Cell(2,2).Width="5";
tableform.Cell(2,3).Width="2";
tableform.Cell(2,4).Width="3";
tableform.Cell(2,5).Width="2";
tableform.Cell(2,6).Width="3";
tableform.Cell(2,7).Width="2";
tableform.Cell(2,8).Width="3";
tableform.Cell(3,1).Width="7";
tableform.Cell(3,2).Width="7";
tableform.Cell(3,3).Width="8";
tableform.Cell(4,1).Width="7";
tableform.Cell(4,2).Width="7";
tableform.Cell(4,3).Width="8";
tableform.Cell(5,1).Width="22";
tableform.Cell(6,1).Width="22";
tableform.range.ParagraphFormat.Alignment = 0; //向左对其
   
// 流程活动区域
//WordApp.Selection.TypeParagraph();        //插入段落   
WordApp.Selection.Font.Bold=false  ;
WordApp.Selection.Font.Size= 11 ;
//selection.Font.color = 16737846;//设置字体格式   
var table=myDoc.Tables.Add (WordApp.Selection.Range, 6,8) //8行7列的表格
table.Rows(1).Cells.Merge();//合并整行    myTable.Cell(2,3).Merge( myTable.Cell(2,4) ); //合并某个单元格 
table.Cell(1,1).range.Text="所有活动实例";
table.Cell(2,1).range.Text="序号";
table.Cell(2,2).range.Text="活动名称";
table.Cell(2,3).range.Text="执行人";
table.Cell(2,4).range.Text="接收时间";
table.Cell(2,5).range.Text="处理时间";
table.Cell(2,6).range.Text="最终时限";
table.Cell(2,7).range.Text="超期";
table.Cell(2,8).range.Text="状态";
for(var i = 1; i < 5 ; i++){
table.Cell(i+2,1).range.Text= i;
table.Cell(i+2,2).range.Text="转送";
table.Cell(i+2,3).range.Text="程可庆";
table.Cell(i+2,4).range.Text="10-09-15 17:19-2";
table.Cell(i+2,5).range.Text="10-09-15 17:19-2";
table.Cell(i+2,6).range.Text="未设置";
table.Cell(i+2,7).range.Text="未超期";
table.Cell(i+2,8).range.Text="已完成";
}

//表格样式设计
table.Cell(1,1).range.Font.Bold=true  ;
table.Rows(2).range.Font.Bold=true  ;
table.Rows.Height =20; //设置行高
table.Cell(1,1).Width = 690;// 某个单元格宽度
for(var i = 2; i < 7 ; i ++){
table.Cell(i,1).Width = 50;
table.Cell(i,2).Width = 60;
table.Cell(i,3).Width = 70;
table.Cell(i,4).Width = 150;
table.Cell(i,5).Width = 150;
table.Cell(i,6).Width = 70;
table.Cell(i,7).Width = 70;
table.Cell(i,8).Width = 70;
} /*
table.Rows.Height =20; //设置行高
table.Borders(-6).LineStyle=1;  //-1上、-2左、-3下、-4右、-5横、-6竖
table.Borders(-6).LineWidth = 6; //边框粗细
table.Borders(-6).Color = 39423; //边框颜色
table.Cells.VerticalAlignment = 定线
table.PreferredWidthType =2;   //单元格宽度类型
table.PreferredWidth =60;   //单元格宽度
table.Cell(2,1).Width = 30;// 某个单元格宽度
*/
//myDoc .saveAs("d:\\gc.doc"); //保存word   
}
wordcontorl();
</script></head>
<body wordcontorl()></body>
</html>
####上面代码可以复制到word里面执行。
我用js创建了两个表格,单独显示一个表格,则可以显示出来,如果两个表格一起显示,则就会乱套。
请求大侠怎样在第一个表格创建之后,把焦点移动到第一个表格最后一行之外在创建第二个表格,解决上面乱套显示的问题。
      谢谢合作。