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

Demonstrationscriptthatretrievesservicedatafromacomputerand

thendisplaysthatdatainaformattedtableinMicrosoftWord.

复制代码 代码如下:

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.Font.Bold=True

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 Formatted Table to a Word Document】相关文章:

jquery插件splitScren实现页面分屏切换模板特效

滚动效果

js-穷举法 (y0h)

对textarea框的代码调试,而且功能上使用非常方便,酷

js实现两点之间画线的方法

Java的不同版本:J2SE、J2EE、J2ME的区别

JavaScript实现带标题的图片轮播特效

javascript匹配车牌号正则表达式

js兼容火狐获取图片宽和高的方法

Jquery动态添加输入框的方法

精品推荐
分类导航