以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  来到附加题20分  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=70762)

--  作者:hbhb
--  发布时间:2015/6/28 17:37:00
--  来到附加题20分
大师:如何将狐表中的表导出到word中?
--  作者:大红袍
--  发布时间: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


--  作者:hbhb
--  发布时间:2015/6/28 18:34:00
--  
好,高!功劳簿记上一笔!加20分。
--  作者:lihe60
--  发布时间:2015/6/28 20:54:00
--  

应加到帮助中。


--  作者:y2287958
--  发布时间:2015/6/28 21:10:00
--  
mark
--  作者:chen37280600
--  发布时间:2021/12/12 20:54:00
--  
mark
--  作者:hongyaoyu2019
--  发布时间:2021/12/13 0:25:00
--  
请问如何设置表插入WORD文件的哪一行?
--  作者:zhy400137
--  发布时间:2021/12/13 1:29:00
--  
mark
--  作者:lihe60
--  发布时间:2021/12/13 8:37:00
--  
这个可以套打吗?