Foxtable(狐表)用户栏目专家坐堂 → 手机返回Excel文件请教


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

主题:手机返回Excel文件请教

帅哥哟,离线,有人找我吗?
一笑
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:808 积分:6213 威望:0 精华:0 注册:2014/3/23 23:02:00
手机返回Excel文件请教  发帖心情 Post By:2018/1/5 17:05:00 [显示全部帖子]

模仿写了以下代码,想实现手机上返回返回的是Excel文件。但点击后页面空白,不知道哪儿不对,请指教,谢谢
....
        With wb.AddButtonGroup("","btg1",True)
            .Add("btn4", "生成Excel格式订单", "button","orders.htm")
        End With

    Case "orders.htm"
        Dim nms() As String = {"姓名","性别","类型","合格证等级","发证日期","有效期至","体检证过期"}
        Dim cmd As New SQLCommand 
        cmd.C 
        cmd.CommandText = "SelecXX 姓名,性别,类型,合格证等级,发证日期,有效期至,体检证过期 From {体检合格证}"
        Dim dt As DataTable = cmd.ExecuteReader
        Dim Book As New XLS.Book
        Dim Sheet As XLS.Sheet = Book.Sheets(0)
        For c As Integer = 0 To nms.Length - 1
            Sheet(0, c).Value = nms(c)
        Next
        For r As Integer = 0 To dt.DataRows.Count - 1
            For c As Integer = 0 To nms.Length - 1
                Sheet(r + 1, c).Value = dt.Datarows(r)(nms(c))
            Next
        Next
        book.PreBuild = False '非报表模请将PreBuild 属性设置为False
        e.WriteBook(book,"体检合格证.xls",True)

注:SelecXX=Select
[此贴子已经被作者于2018/1/5 17:05:30编辑过]

 回到顶部