Foxtable(狐表)用户栏目专家坐堂 → 打印后台数据


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

主题:打印后台数据

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/5/8 9:27:00 [显示全部帖子]

Dim doc As New PrintDoc
Dim rt As New prt.RenderTable
Dim cmd As New SQLCommand '定义一个SQL命令
Dim dt As DataTable '定义一个数据表变量
Dim Count As Integer = 0
cmd.CommandText = "Select * From {订单} Where Year(日期) = 2009 And Month(日期) = 6"
dt = cmd.ExecuteReader() '生成一个临时表
For Each Col As DataCol In Dt.DataCols
    rt.Cells(0,Count).Text = Col.Name
    For r As Integer = 0 To dt.DataRows.Count - 1
        If dt.DataRows(i).IsNull(Col.Name) Then
            rt.Cells(r +1,Count).Text = ""
        Else
            rt.Cells(r +1,Count).Text = dt.DataRows(r)(Col.Name)
        End If
    Next
    Count = Count + 1
Next
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray) '灰色网格线
rt.CellStyle.Spacing.All = 1 '内容距离网格线1毫米
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center '第一行内容水平居中
doc.Body.Children.Add(rt)
doc.Preview()

 回到顶部