以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 手机返回Excel文件请教 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=112961) |
-- 作者:一笑 -- 发布时间:2018/1/5 17:05:00 -- 手机返回Excel文件请教 模仿写了以下代码,想实现手机上返回返回的是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编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/1/5 17:23:00 -- 试试这样写
book.PreBuild = False \'非报表模请将PreBuild 属性设置为False
e.WriteBook(book,"体检合格证.xls",True)
return \'为了下面不再执行如 e.WriteString |