手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >Add a Table to a Word Document
Add a Table to a Word Document
摘要:Demonstrationscriptthatretrievesserviceinformationfromacomputerandthen...

Demonstrationscriptthatretrievesserviceinformationfroma

computerandthendisplaysthatinformationintabularformatinMicrosoftWord.

复制代码 代码如下:

SetobjWord=CreateObject("Word.Application")

objWord.Visible=True

SetobjDoc=objWord.Documents.Add()

SetobjRange=objDoc.Range()

objDoc.Tables.AddobjRange,1,3

SetobjTable=objDoc.Tables(1)

x=1

strComputer="."

SetobjWMIService=_

GetObject("winmgmts:"&strComputer&"rootcimv2")

SetcolItems=objWMIService.ExecQuery("Select*fromWin32_Service")

ForEachobjItemincolItems

Ifx>1Then

objTable.Rows.Add()

EndIf

objTable.Cell(x,1).Range.Text=objItem.Name

objTable.Cell(x,2).Range.text=objItem.DisplayName

objTable.Cell(x,3).Range.text=objItem.State

x=x+1

Next

【Add a Table to a Word Document】相关文章:

用NODE.JS中的流编写工具是要注意的事项

Javascript客户端脚本的设计和应用

JavaScript对表格或元素按文本,数字或日期排序的方法

AngularJS中$interval的用法详解

JavaScript中指定函数名称的相关方法

JS获取当前脚本文件的绝对路径

JavaScript静态的动态

Add a Formatted Table to a Word Document

图片之间的切换

谈一谈javascript闭包

精品推荐
分类导航