Foxtable(狐表)用户栏目专家坐堂 → 怎样将个临时表导到一个表单中


  共有2563人关注过本帖树形打印复制链接

主题:怎样将个临时表导到一个表单中

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110766 积分:563762 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/6/14 20:17:00 [显示全部帖子]

Dim zhkdmbm As DataRow = DataTables("组合框代码").DataRows(11) '组合框代码中的第11行
Dim Multi As String = zhkdmbm("列表项目")                      '组合框代码中的第11行的列表项目一列的值
Dim Values() As String = Multi.split("|")                    '用号分割成姓名数据
Dim Book As New XLS.Book '定义一个Excel工作簿
'Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
Book.Sheets.RemoveAt(0)
For Index As  Integer = 0 To Values.Length - 1        '从0开始
    e.Form.Controls("TextBox4").Text = Values(Index)
    Dim sj As Date = e.form.controls("DateTimePicker2").Value  '将当前日期赋值给DateTimePicker1
    Dim d1 As Date = sj.AddDays(6) '加上6天
    Dim dtb1 As New DataTableBuilder(Values(Index))
    Dim ta1 As DataTable
    dtb1.AddDef("零件图号",     Gettype(String), 32)'字符型
    dtb1.AddDef("零件名称",     Gettype(String), 32)
    dtb1.AddDef("零件属性",    Gettype(String), 32)
    dtb1.AddDef("来货数量", Gettype(Integer))  '数值型
    ta1 =  dtb1.Build()
    Dim Cols1() As String = {"编号图号","部件名称","颜色","交检"}
    Dim Cols2() As String = {"零件图号","零件名称","零件属性","来货数量"}
    For Each dr1 As DataRow In DataTables("部品质量管理").Select("日期 = '" & sj & "'and 检验员 = '" & Values(Index) & "' and 序号 = 0")
        Dim dr2 As DataRow = DataTables(Values(Index)).AddNew()
        For i As Integer = 0 To Cols1.Length -1
            dr2(Cols2(i)) = dr1(Cols1(i))
        Next
    Next
    Dim jyy1 As Integer = Tables(Values(Index)).Rows.Count
    
    Book.Sheets.Add(Values(Index)) '增加一个工作表
    Dim Sheet As XLS.Sheet = Book.Sheets(Values(Index)) '引用工作簿的第一个工作表
    Dim bb1 As Table = Tables(Values(Index))
    Dim nms1()  As String = {"零件图号","零件名称","零件属性","来货数量"} '要导出的列名
    For r As Integer = 0 To bb1.Rows.Count - 1   '填入数据
        For c As Integer = 0 To nms1.length -1
            Sheet(r + 6, c+1).Value = bb1.rows(r)(nms1(c))
        Next
    Next
    
    
Next
Book.Save("c:\reports\test.xls") '保存工作簿
'Dim Proc As New Process '打开工作簿
'Proc.File = "c:\reports\test.xls"
'Proc.Start()

 回到顶部