JavaScript Tutorials dynamically add a table to Word doc documents
<script> Function Wordcontorl () { alert ("Baby Meng Jia"); var wordapp=new activexobject ("Word.Application"); var wdcharacter=1 var wdorientlandscape = 1 wordapp.application.visible=true;//Eject the generated word after execution is completed var mydoc=wordapp.documents.add ()//Create a new empty document WordApp.ActiveDocument.PageSetup.Orientation = wdorientlandscape// The page orientation is set to landscape WordApp. Selection.paragraphformat.alignment=1//1 is centered, 0 is the right WordApp. Selection.font.bold=true WordApp. Selection.font.size=20 WordApp. Selection.TypeText ("Meng Jia incense"); WordApp. Selection.MoveRight (wdcharacter); The cursor moves the character to the right WordApp.Selection.TypeParagraph ()//Insert paragraph WordApp. Selection.font.size=12 WordApp. Selection.TypeText ("written-----Zhu Yu"); Branch Insert date WordApp.Selection.TypeParagraph ()//Insert paragraph var mytable=mydoc.tables.add (WordApp.Selection.Range, 8,7 //8 Row 7 Column table //mytable.style= grid var aa = "Meng Jia title" var Tablerange;//The following is assigned to cells in a table for (i= 0;i<7;i++) { with (Mytable.cell (1,i+1). Range) { Font. Size = 12; InsertAfter (AA); ColumnWidth =4 } } for (n =0;n<7;n++) { to (I =0;i<7; i++) { with (Mytable.cell +1). Range) {font. Size = 12; InsertAfter (www.jzread.com); } } } Row_count = 0; Col_count = 0 Mydoc.protect (1) } Wordcontorl () </script>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.