复代码 代码如下: <머리> 스크립트로 문서 작성 <br>함수 word_onclick() <br>{ <br>var myDocApp=null; <br>myDocApp =new ActiveXObject("word.Application"); <br>myDocApp.Application.Visible = true; <br>var myDoc = myDocApp.Documents.Add(); <br><br>myDocApp.Selection.ParagraphFormat.Alignment=1 <br>myDocApp.Selection.Range.Bold=true; <br>myDocApp.Selection.Font.Size=22; <br>myDocApp.Selection.Text="请假申请单" <br>myDocApp.Selection.insertAfter("n"); <br>myDocApp.Selection.MoveRight(2,10); <br>myDocApp.Selection.TypeParagraph(); <br>myDocApp.Selection.Font.Bold=false; <br>myDocApp.Selection.Font.Size=12; <br><br>var myTable0=myDoc.Tables.Add(myDocApp.Selection.Range,3,4); <br>myTable0.cell(1,1).Range.Text="请假人"; <br>myTable0.cell(1,2).Range.Text="张三"; <br>myTable0.cell(1,3).Range.Text="请假时间"; <br>myTable0.cell(1,4).Range.Text="2006-2-10"; <br><br>myTable0.cell(2,1).Range.Text="工号"; <br>myTable0.cell(2,2).Range.Text="32412"; <br>myTable0.cell(2,3).Range.Text="填表时间"; <br>myTable0.cell(2,4).Range.Text="2006-2-9"; <br><br>myTable0.cell(3,1).Range.Text="请假하라因"; <br>myTable0.cell(3,2).Range.Text="感冒"; <br>myTable0.cell(3,3).Range.Text="处理方式"; <br>myTable0.cell(3,4).Range.Text="病假"; <br><br>var range=myDocApp.ActiveDocument.Content; <br>range.Collapse(0); <br>range.insertAfter("n"); <br>범위=myDocApp.ActiveDocument.Content; <br>range.Collapse(0); <br><br>var myTable2=myDoc.Tables.Add(range,1,2); <br>myTable2.Columns(1).SetWidth(320,2); <br>myTable2.cell(1,1).Range.Text="申请人签name" //공중화 <br>myTable2.cell(1,2).Range.Text="申请人签name"; <br><br>시도해 보세요{ <br>myDocApp.ActiveDocument.SaveAs("e:\JaveToWord.doc"); <br>}catch(예외){ <br>alert("浏览器안전设置过高,保存文件到本地失败"); <br>myDocApp.Documents.close(); <br>myDocApp.Application.quit(); <br>myDocApp=null; <br>window.close(); <br>} <br>} <br> 生成WORD