手机
当前位置:查字典教程网 >编程开发 >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】相关文章:

jQuery插件zepto.js简单实现tab切换

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

AngularJS中$interval的用法详解

JavaScript中的Math.LOG2E属性使用详解

巧妙破除网页右键禁用的十大绝招

Add a Formatted Table to a Word Document

自动设为主页

JQuery自动触发事件的方法

javascript瀑布流布局实现方法详解

图片之间的切换

精品推荐
分类导航