Home  >  Article  >  Web Front-end  >  Dynamically add code to js word table_javascript skills

Dynamically add code to js word table_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:25:291466browse
Copy code The code is as follows:

<script> <br>function wordcontorl(){ <br> alert("Xiao Mengjia's baby"); <br>var WordApp=new ActiveXObject("Word.Application"); <br>var wdCharacter=1 <br>var wdOrientLandscape = 1 <br>WordApp.Application.Visible= true; //Whether the generated word will pop up after execution is completed <br>var myDoc=WordApp.Documents.Add();//Create a new empty document <br>WordApp.ActiveDocument.PageSetup.Orientation = wdOrientLandscape//Page orientation Set to landscape<br>WordApp. Selection.ParagraphFormat.Alignment=1 //1 is center-aligned, 0 is right-aligned<br>WordApp. Selection.Font.Bold=true <br>WordApp. Selection.Font.Size=20 <br>WordApp. Selection.TypeText("Meng Jia Burns Incense"); <br>WordApp. Selection.MoveRight(wdCharacter); // Move the cursor to the right character <br> WordApp.Selection.TypeParagraph() // Insert a paragraph <br> WordPress. 🎜>var myTable=myDoc.Tables.Add (WordApp.Selection.Range, 8,7) //Table with 8 rows and 7 columns<br>//myTable.Style="Grid type" <br>var aa = " Meng Jia title " <br>var TableRange; //The following is to assign values ​​to the cells in the table <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("Meng Jia cute"); <BR>} <BR>} <BR>} <BR>row_count = 0; <BR>col_count = 0 <BR>myDoc .Protect(1) <BR>} <BR>wordcontorl() <BR></script>


There are many ways to implement each function. I hope you can exchange different ideas and methods. . You can add QQ412546724. hehe
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn