Foxtable(狐表)用户栏目专家坐堂 → 请教报表打印换页问题


  共有12883人关注过本帖平板打印复制链接

主题:请教报表打印换页问题

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


加好友 发短信
等级:幼狐 帖子:110 积分:1367 威望:0 精华:0 注册:2008/9/1 12:35:00
请教报表打印换页问题  发帖心情 Post By:2011/11/27 22:23:00 [只看该作者]

Dim doc As New Printdoc
Dim rx,rx1 As new prt.RenderText
Dim rt As New prt.RenderTable() '定义一个表格对象
Dim prs As Integer = 9 '每页9行
Dim tb As Table = Tables("订单.订单明细")
Dim sum1 As Double = 0
Dim sum2 As Double = 0
Dim rs As Integer = Tables("订单.订单明细").Rows.Count

rx.text =" 订单编号: " & Tables("订单").Current("订单编号")
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rx.Style.Font = New Font("宋体", 16, FontStyle.Bold)
doc.Body.Children.Add(rx)

For p As Integer = 0 To math.Ceiling(rs/prs) - 1
   
    rt.Cols.Count = 4   '设置rt行列数
    rt.Rows.Count = 9
    rt.Height = 130

    For i As Integer = 0 To 13
    rt.Rows(i).Height = 10 '设置rt行高
    Next
   
   rt.Rows(0).Style.Borders.bottom = New prt.Linedef '设置rt行格式
   rt.Rows(1).Style.Borders.bottom = New prt.Linedef
   rt.Rows(2).Style.Borders.bottom = New prt.Linedef
   rt.Rows(3).Style.Borders.bottom = New prt.Linedef
   rt.Rows(4).Style.Borders.bottom = New prt.Linedef
   rt.Rows(5).Style.Borders.bottom = New prt.Linedef
   rt.Rows(6).Style.Borders.bottom = New prt.Linedef
   rt.Rows(7).Style.Borders.bottom = New prt.Linedef
   rt.Rows(8).Style.Borders.bottom = New prt.Linedef
   rt.Rows(9).Style.Borders.bottom = New prt.Linedef
  
  
   rt.Cells(0,0).Text = "产品"  '设置rt表头
   rt.Cells(0,1).Text = "单价"
   rt.Cells(0,2).Text = "数量"
   rt.Cells(0,3).Text = "金额"
   rt.Cells(10,2).Text = " 数量: " & sum1
     For r As Integer = 0 To tb.Rows.Count - 1 '遍历关联表每一行
        rt.Cells(r+1,0).Text = tb.rows(r)("产品")
        rt.Cells(r+1,1).Text = tb.rows(r)("单价")
        rt.Cells(r+1,2).Text = tb.rows(r)("数量")
        rt.Cells(r+1,3).Text = tb.rows(r)("金额")
       
      Next
      sum1 = 0
      sum2 = 0
     
      For r As Integer = p * prs To math.min(rs - 1,( p + 1) * prs - 1)

        sum1 =sum1 + tb.rows(r)("数量")
       
      Next
   
     If p < math.Ceiling(rs/ prs) - 1
        rt.BreakAfter = prt.BreakEnum.Page
     End If
 
    doc.Body.Children.Add(rt)
Next
  
   rx1.text =" 白色  深红  浅蓝  浅黄   浅绿   浅红 "
   rx1.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
   rx1.Style.Font = New Font("宋体", 12, FontStyle.Bold) 
   doc.Body.Children.Add(rx1)

 

doc.Preview

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.table

[此贴子已经被作者于2011-11-28 13:52:21编辑过]

 回到顶部