以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]如何导出窗口表中的分组行? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=179873) |
-- 作者:hzcaqjf -- 发布时间:2022/9/15 10:21:00 -- [求助]如何导出窗口表中的分组行? 如何导出窗口表中的分组行到指定的excel表格当中? Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "Excel文件|*.xls" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then Dim tbl As Table = Tables("首页_table1") \'Dim hdr As Integer = tbl.HeaderRows \'获得表头的层数 Dim Book As New XLS.Book(dlg.FileName) Dim Sheet As XLS.Sheet = Book.Sheets(0) \'tbl.CreateSheetHeader(Sheet,0,0,False) \'生成表头 For c As Integer = 0 To tbl.Cols.Count - 1 For r As Integer = 0 To tbl.Rows.Count - 1 sheet(r + 3,c).value = tbl(r,c) Next Next Book.Save(dlg.FileName) Dim Proc As New Process Proc.File = dlg.FileName Proc.Start() End If 上面代码只能导出数据行,小计和总计等分组行不能导出到指定的excel表格中. |
-- 作者:有点蓝 -- 发布时间:2022/9/15 10:29:00 -- 看看:http://www.foxtable.com/webhelp/topics/1594.htm For c As Integer = 0 To tbl.Cols.Count - 1 For r As Integer = 0 To tbl.Rows.Count(true) - 1 sheet(r + 3,c).value = tbl.rows(r,true)(c) Next Next |
-- 作者:hzcaqjf -- 发布时间:2022/9/15 10:33:00 -- 分组行也可导出了,谢谢蓝老师. |