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

JavaScript中继承用法实例分析

网页常用特效代码整理

理解javascript定时器中的单线程

nodejs实现遍历文件夹并统计文件大小

滚动效果

javascript实现行拖动的方法

编写高质量JavaScript代码的基本要点

Jquery zTree 树控件异步加载操作

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

jquery实现动态改变div宽度和高度

精品推荐
分类导航