Foxtable(狐表)用户栏目专家坐堂 → 来到附加题20分


  共有4986人关注过本帖树形打印复制链接

主题:来到附加题20分

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/6/28 17:51:00 [显示全部帖子]

mark word表格

 

Dim app As New MSWord.Application
try
    Dim doc = app.Documents.add
    Dim dt As DataTable = DataTables("表A")
    doc.Tables.Add(Range:=app.Selection.Range,NumRows:=1, NumColumns:= dt.DataCols.Count)
    With app.Selection.Tables(1)
        .ApplyStyleHeadingRows = True
        .ApplyStyleLastRow = True
        .ApplyStyleFirstColumn = True
        .ApplyStyleLastColumn = True
    End With
    For Each dc As DataCol In dt.DataCols
        app.Selection.TypeText(Text:=dc.Name)
        app.Selection.MoveRight(Unit:=12)
    Next
    For Each dr As DataRow In dt.DataRows
        For Each dc As DataCol In dt.DataCols
            app.Selection.TypeText(Text:=dr(dc.Name))
            app.Selection.MoveRight(Unit:=12)
        Next
    Next
    app.Visible = True
catch ex As exception
    msgbox(ex.message)
    app.Quit
finally
   
End try


 回到顶部