<script> <br>function wordcontorl(){ <br>alert("小孟佳的宝贝"); <br>var WordApp=new ActiveXObject("Word.Application"); <br>var wdCharacter=1 <br>var wdOrientLandscape = 1 <br>WordApp.Application.Visible=true; //执行完成之后是否弹出已经生成的word <br>var myDoc=WordApp.Documents.Add();//创建新的空文档 <br>WordApp.ActiveDocument.PageSetup.Orientation = wdOrientLandscape//页面方向设置为横向 <br>WordApp. Selection.ParagraphFormat.Alignment=1 //1居中对齐,0为居右 <br>WordApp. Selection.Font.Bold=true <br>WordApp. Selection.Font.Size=20 <br>WordApp. Selection.TypeText("孟佳烧香"); <br>WordApp. Selection.MoveRight(wdCharacter); //光标右移字符 <br>WordApp.Selection.TypeParagraph() //插入段落 <br>WordApp. Selection.Font.Size=12 <br>WordApp. Selection.TypeText("-----朱漪编写"); //分行插入日期 <br>WordApp.Selection.TypeParagraph() //插入段落 <br>var myTable=myDoc.Tables.Add (WordApp.Selection.Range, 8,7) //8行7列的表格 <br>//myTable.Style="网格型" <br>var aa = "孟佳标题" <br>var TableRange; //以下为给表格中的单元格赋值 <br>for (i= 0;i<7;i ) <BR>{ <BR>with (myTable.Cell(1,i 1).Range) <BR>{ <BR>font.Size = 12; <BR>InsertAfter(aa); <BR>ColumnWidth =4 <BR>} <BR>} <BR>for (n =0;n<7;n ) <BR>{ <BR>for (i =0;i<7 ;i ) <BR>{ <BR>with (myTable.Cell(i 2,n 1).Range) <BR>{font.Size = 12; <BR>InsertAfter("孟佳小可爱"); <BR>} <BR>} <BR>} <BR>row_count = 0; <BR>col_count = 0 <BR>myDoc.Protect(1) <BR>} <BR>wordcontorl() <BR></script>
每种功能的实现方法有很多,希望各位可以交流不同的思想和方法。可以加QQ412546724。呵呵