象这样: 将表中的内容导出到WORD Dim wordApp As New Word.Application() Dim myDoc As Word.Document Dim oTable As Word.Table Dim rowIndex, colIndex As Integer rowIndex = 1 colIndex = 0 wordApp.Documents.Add() myDoc = wordApp.ActiveDocument oTable = myDoc.Tables.Add(Range:=myDoc.Range(Start:=0, End:=0), NumRows:=Table.Rows.Count + 1, NumColumns:=Table.Columns.Count)
如果数据源是vsflexgrid 应该怎么样导出到word里啊?
一个道理,循环行、列,往WORD里的Tables里加
下面这段代码那里有错误啊?非常感谢Dim vs As New VSFlexGrid vs = frmmain.VSFlexGrid1 Dim cell As VSFlexGridcell For Each cell In vs.Cells rowIndex = rowIndex + 1 colIndex = colIndex + 1 oTable.cell(rowIndex, colIndex).Range.InsertAfter (vs.cell(rowIndex, colIndex).Text) Nex
参考:
http://www.csdn.net/develop/author/netauthor/lihonggen0/http://www.csdn.net/develop/read_article.asp?id=14952
http://www.csdn.net/develop/read_article.asp?id=16987
将表中的内容导出到WORD Dim wordApp As New Word.Application() Dim myDoc As Word.Document Dim oTable As Word.Table Dim rowIndex, colIndex As Integer rowIndex = 1 colIndex = 0 wordApp.Documents.Add() myDoc = wordApp.ActiveDocument oTable = myDoc.Tables.Add(Range:=myDoc.Range(Start:=0, End:=0), NumRows:=Table.Rows.Count + 1, NumColumns:=Table.Columns.Count)
应该怎么样导出到word里啊?
vs = frmmain.VSFlexGrid1
Dim cell As VSFlexGridcell
For Each cell In vs.Cells
rowIndex = rowIndex + 1
colIndex = colIndex + 1
oTable.cell(rowIndex, colIndex).Range.InsertAfter (vs.cell(rowIndex, colIndex).Text)
Nex