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