Home > Web Front-end > JS Tutorial > body text

Dynamically add code to js word table_javascript skills

WBOY
Release: 2016-05-16 18:25:29
Original
1465 people have browsed it
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
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!