社区
VB基础类
帖子详情
高分求:如何将listview表格中的内容导出到EXCEL2000文件中?
tianhao123
2003-12-09 05:26:14
最好给个例子!
...全文
91
2
打赏
收藏
高分求:如何将listview表格中的内容导出到EXCEL2000文件中?
最好给个例子!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
Kain
2003-12-09
打赏
举报
回复
mark
SoHo_Andy
2003-12-09
打赏
举报
回复
'将listView中的数据导出到Excel的例子
'希望对你有帮助
Private Sub PrintToExcel()
On Error GoTo ErrTrap
Dim xlsApp As New Excel.Application
Dim xlsBook As New Excel.Workbook
Dim xlsSheet As New Excel.Worksheet
Dim i As Integer
Dim j As Integer
Dim xlsRow As Integer
Dim xlsCol As Integer
xlsCol = lsvShow.ColumnHeaders.Count - 3
xlsRow = 3
Set xlsBook = xlsApp.Workbooks.Add
Set xlsSheet = xlsBook.Worksheets(1)
xlsSheet.PageSetup.Orientation = xlLandscape '横向打印
frm_Wait.Show
xlsApp.Columns(1).NumberFormatLocal = "@"
'写入列名
For i = 1 To lsvShow.ColumnHeaders.Count - 3
xlsApp.Cells(xlsRow, i) = " " & Trim(lsvShow.ColumnHeaders(i).Text)
xlsApp.Columns(i).Select
xlsApp.Selection.ColumnWidth = lsvShow.ColumnHeaders(i).Width / 100
Next i
'xlsApp.Columns(1).AutoFit
xlsRow = xlsRow + 1
'写入列表内容
For i = 1 To lsvShow.ListItems.Count
xlsApp.Cells(xlsRow, 1) = Trim(lsvShow.ListItems(i).Text)
For j = 1 To lsvShow.ColumnHeaders.Count - 4
xlsApp.Cells(xlsRow, j + 1) = Trim(lsvShow.ListItems(i).SubItems(j))
xlsApp.Cells(xlsRow, j + 1).WrapText = True
Next j
xlsRow = xlsRow + 1
Next i
'写入标题和时间
xlsApp.Range(xlsApp.Cells(1, 1), xlsApp.Cells(1, xlsCol)).Select
With xlsApp.Selection
.MergeCells = True
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
xlsApp.Cells(1, 1) = labKeyName.Caption
xlsApp.Cells(1, 1).Font.Size = 24
xlsApp.Cells(1, 1).Font.Bold = True
xlsApp.Cells(2, 1) = "打印时间:" & Date
'设置边框
xlsApp.Range(xlsApp.Cells(3, 1), xlsApp.Cells(xlsRow, xlsCol)).Select
With xlsApp.Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
With xlsApp.Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With xlsApp.Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With xlsApp.Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
With xlsApp.Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
With xlsApp.Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
xlsApp.Visible = True
frm_Wait.Visible = False
Call VBA.AppActivate(xlsBook.Name)
On Error GoTo 0
Exit Sub
ErrTrap:
On Error GoTo 0
End Sub
Android遍历获取Office格式(Word,
Excel
,PPT,PDF)的
文件
并打开
此案例主要是模仿QQ加载WPS(Word,
Excel
,PPT)本地
文件
可打开查看,使用
ListView
加载,使用线程扫描SD卡下所有目录加载指定的Word,
Excel
,PPT等格式的
文件
,
ListView
列表显示,点击Item则调用系统应用打开。 效果图: 代码: public class MainActivity extends AppCompatActiv...
VB将数据显示在
ListView
中
最近在学VB,所以把一些东西都记下来,方便以后学习。下面是将数据查处来显示在
ListView
中
Dim ledrst As ADODB.Recordset Set ledrst = New ADODB.Recordset ledrst.Open sql, g_SqlDBConn, adOpenDynamic, adLockPessimistic
ListView
_Show Me
vb.net获取服务器
中
所有数据库名称显示在list,vb
listview
显示数据库
内容
,该怎么解决...
当前位置:我的异常网» VB»vb
listview
显示数据库
内容
,该怎么解决vb
listview
显示数据库
内容
,该怎么解决www.myexceptions.net网友分享于:2013-03-22浏览:23次vb
listview
显示数据库
内容
我想用
listview
显示数据库的
内容
,但执行之后,
listview
一片空白。我的代码是Private Sub Form_Load()Dim ...
android 读取wps_Android遍历获取Office格式(Word,
Excel
,PPT,PDF)的
文件
并打开
此案例主要是模仿QQ加载WPS(Word,
Excel
,PPT)本地
文件
可打开查看,使用
ListView
加载,使用线程扫描SD卡下所有目录加载指定的Word,
Excel
,PPT等格式的
文件
,
ListView
列表显示,点击Item则调用系统应用打开。效果图: 代码:public class MainActivity extends AppCompatActivity {public ProgressD...
CListCtrl应用,check,导入到
excel
,实现点击列头排序
CListCtrl应用,check,导入到
excel
,实现点击列头排序 2007-11-06 10:31 初始化: DWORD dwStyle; dwStyle = m_bzlist.GetStyle(); dwStyle |= LVS_EX_GRIDLINES |LVS_EX_FULLROWSELECT|LVS_SHOWSELALWAYS ; m_bzlist.SetExtended
VB基础类
7,788
社区成员
197,583
社区内容
发帖
与我相关
我的任务
VB基础类
VB 基础类
复制链接
扫一扫
分享
社区描述
VB 基础类
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章