2个回答
2013-06-23
展开全部
我这里有一段是从dataset写到excel的,你只要把ds里的字段改成vsflexgrid的单元格就可以了,你先研究一下,有问题可以再找我.
Dim excel As Excel.Application = New Excel.Application
excel.DisplayAlerts = True
excel.Workbooks.Add(True)
'excel.Visible = True
Dim i As Integer
excel.Cells(8, 1) = "brand_key"
excel.Cells(8, 2) = "Season_Key"
excel.Cells(8, 3) = "article_key"
excel.Cells(8, 4) = "color_key"
excel.Cells(8, 5) = "inseam_key"
For i = 0 To ds.Tables(0).Rows.Count - 1
excel.Cells(i + 9, 1) = ds.Tables(0).Rows(i)("brand_key").ToString().Trim()
excel.Cells(i + 9, 2) = ds.Tables(0).Rows(i)("Season_Key").ToString().Trim()
excel.Cells(i + 9, 3) = ds.Tables(0).Rows(i)("article_key").ToString().Trim()
excel.Cells(i + 9, 4) = ds.Tables(0).Rows(i)("color_key").ToString().Trim()
excel.Cells(i + 9, 5) = ds.Tables(0).Rows(i)("inseam_key").ToString().Trim()
excel.Cells(i + 9, 6) = ds.Tables(0).Rows(i)("size_Key").ToString().Trim()
Next
Dim excel As Excel.Application = New Excel.Application
excel.DisplayAlerts = True
excel.Workbooks.Add(True)
'excel.Visible = True
Dim i As Integer
excel.Cells(8, 1) = "brand_key"
excel.Cells(8, 2) = "Season_Key"
excel.Cells(8, 3) = "article_key"
excel.Cells(8, 4) = "color_key"
excel.Cells(8, 5) = "inseam_key"
For i = 0 To ds.Tables(0).Rows.Count - 1
excel.Cells(i + 9, 1) = ds.Tables(0).Rows(i)("brand_key").ToString().Trim()
excel.Cells(i + 9, 2) = ds.Tables(0).Rows(i)("Season_Key").ToString().Trim()
excel.Cells(i + 9, 3) = ds.Tables(0).Rows(i)("article_key").ToString().Trim()
excel.Cells(i + 9, 4) = ds.Tables(0).Rows(i)("color_key").ToString().Trim()
excel.Cells(i + 9, 5) = ds.Tables(0).Rows(i)("inseam_key").ToString().Trim()
excel.Cells(i + 9, 6) = ds.Tables(0).Rows(i)("size_Key").ToString().Trim()
Next
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-06-23
展开全部
用 VSFlexGrid1.SaveGrid 导出到excel
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询