![]() |
|
||||||||||||||
| | 网站首页 | 数据库教程 | web编程 | 服务器 | 程序设计 | | ||
|
||
|
||||||
| 将ListView数据导出至Execl | ||||||
作者:佚名 文章来源:不详 点击数: 更新时间:2007-9-2 ![]() |
||||||
|
将ListView数据导出至Execl 在进行数据库编程的过程中经常会对数据进行导出到 Execl 。
dim my_excel As New Excel.Application dim my_book As New Excel.Workbook dim my_sheet As New Excel.Worksheet dim Li_Count as integer'总行数 dim Li_i as integer'循环计数 Set my_excel = CreateObject("Excel.Application") '创建对象 Set my_book = my_excel.Workbooks.Add Set my_sheet = my_book.Worksheets(1) my_sheet.Cells(1, 1) = "销售明细" my_sheet.Cells(2, 1) = "客户名称" my_sheet.Cells(2, 2) = "提货日期" my_sheet.Cells(2, 3) = "品名" my_sheet.Cells(2, 4) = "所属分类" my_sheet.Cells(2, 5) = "品牌" my_sheet.Cells(2, 6) = "规格型号" my_sheet.Cells(2, 7) = "单位" my_sheet.Cells(2, 8) = "数量" my_sheet.Cells(2, 9) = "单价" my_sheet.Cells(2, 10) = "金额" my_sheet.Cells(2, 11) = "毛利" my_sheet.Cells(2, 12) = "经办人" Li_Count = lstmx.ListItems.Count For Li_i = 1 To Li_Count my_sheet.Cells(Li_i + 2, 1) = lstmx.ListItems(Li_i).Text my_sheet.Cells(Li_i + 2, 2) = lstmx.ListItems(Li_i).SubItems(1) my_sheet.Cells(Li_i + 2, 3) = lstmx.ListItems(Li_i).SubItems(2) my_sheet.Cells(Li_i + 2, 4) = lstmx.ListItems(Li_i).SubItems(3) my_sheet.Cells(Li_i + 2, 5) = lstmx.ListItems(Li_i).SubItems(4) my_sheet.Cells(Li_i + 2, 6) = lstmx.ListItems(Li_i).SubItems(5) my_sheet.Cells(Li_i + 2, 7) = lstmx.ListItems(Li_i).SubItems(6) my_sheet.Cells(Li_i + 2, 8) = lstmx.ListItems(Li_i).SubItems(7) my_sheet.Cells(Li_i + 2, 9) = lstmx.ListItems(Li_i).SubItems(8) my_sheet.Cells(Li_i + 2, 10) = lstmx.ListItems(Li_i).SubItems(9) my_sheet.Cells(Li_i + 2, 11) = lstmx.ListItems(Li_i).SubItems(10) my_sheet.Cells(Li_i + 2, 12) = lstmx.ListItems(Li_i).SubItems(11) my_excel.Visible = gs_bl_True Set my_excel = Nothing 本文来源:http://blog.csdn.net/heimaoxiaozi/archive/2007/08/13/1740547.aspx
|
||||||
| 文章录入:admin 责任编辑:admin | ||||||
| 【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 | ||||||
| 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!) |
| | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 网站公告 | 网站地图 | 管理登录 | | |||
|