Add a Formatted Table to a Word Document

2016-02-19 09:24 2 1 收藏

今天图老师小编要跟大家分享Add a Formatted Table to a Word Document,精心挑选的过程简单易学,喜欢的朋友一起来学习吧!

【 tulaoshi.com - Web开发 】

Demonstration script that retrieves service data from a computer and 
then displays that data in a formatted table in Microsoft Word. 
代码如下:

Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()

Set objRange = objDoc.Range()
objDoc.Tables.Add objRange,1,3
Set objTable = objDoc.Tables(1)

x=1

strComputer = "."
Set objWMIService = _
    GetObject("winmgmts:" & strComputer & "rootcimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service")

For Each objItem in colItems
    If x  1 Then
        objTable.Rows.Add()
    End If
    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




来源:https://www.tulaoshi.com/n/20160219/1590676.html

延伸阅读
用BCB进行多媒体数据库开发时常会发现这样一个现象,当你把一条记录从表中删除时,表档 大小并没有相应减小。这样在进行多次插入删除之后,表文件就会越来越庞大。之所以会出现这种现象,是因为TTable控件的 Delete Method并不真正从表中删除记录,而只是在记录前加上一个删除标志。在DBase和FoXPro中用Pack语句对表进行压缩,但在TTable类...
标签: MySQL mysql数据库
  MySQL中create table语句的基本语法是: CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)] [table_options] [select_statement] TEMPORARY:该关键字表示用create table新建的表为临时表,此表在当前会话结束后将自动消失。临时表主要被应用于存储过程中,对于目前尚不支持存储过程的MySQL,该关键字一...
标签: Web开发
我觉得比ijao简单,但是脑子就是转不过弯。。。。请正则高手看看阿。 代码如下: textarea id="txt"  table border=1 width="20%"                    trthtitle/ththtitle2/th/tr      &n...
标签: Web开发
Cascading Style Sheets: The Definitive Guide, 2nd Edition is a thorough review of all aspects of CSS2.1 and a comprehensive guide to CSS implementation. The book includes new content on positioning, lists and generated content, table layout, user interface, paged media, and more. It explores in detail each individ...

经验教程

316

收藏

70
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部