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


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

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

美女呀,离线,留言给我吧!
yangming
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:超级版主 帖子:4109 积分:23338 威望:0 精华:21 注册:2008/9/1 20:07:00
  发帖心情 Post By:2011/11/28 13:51:00 [显示全部帖子]

以下是引用狐友在2011-11-28 12:59:00的发言:

还是没搞定,帮忙看下

您想要什么效果?没明白意思


 回到顶部
美女呀,离线,留言给我吧!
yangming
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:超级版主 帖子:4109 积分:23338 威望:0 精华:21 注册:2008/9/1 20:07:00
  发帖心情 Post By:2011/11/28 17:51:00 [显示全部帖子]

试试这个:

Dim doc As New Printdoc
Dim rx As new prt.RenderText
Dim prs As Integer = 9 '每页7行
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)
rx.Style.Borders.Bottom = New prt.LineDef(1, Color.Green) '设置底边框
rx.Style.Padding.Bottom = 5'底端内容缩进0.5毫米

Doc.PageHeader = rx
For p As Integer = 0 To math.Ceiling(rs/prs) - 1
   
    Dim rt As New prt.RenderTable() '定义一个表格对象
    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.Cells(0,0).Text = "产品"  '设置rt表头
    rt.Cells(0,1).Text = "单价"
    rt.Cells(0,2).Text = "数量"
    rt.Cells(0,3).Text = "金额"
    For r As Integer = p * prs To math.min(rs- 1,( p + 1) * prs - 1)
        rt.Cells(r - p * prs + 1, 0).Text = tb.rows(r)("产品")
        rt.Cells(r - p * prs + 1, 1).Text =  tb.rows(r)("单价")
        rt.Cells(r - p * prs + 1, 2).Text  = tb.rows(r)("数量")
        rt.Cells(r - p * prs + 1, 3).Text = tb.rows(r)("金额")
       
       
    Next
    sum1 = 0
   
    For r1 As Integer = p * prs To math.min(rs - 1,( p + 1) * prs - 1)
       
        sum1 =sum1 + tb.rows(r1)("数量")
       
    Next
   
    If p < math.Ceiling(rs/ prs) - 1
        rt.BreakAfter = prt.BreakEnum.Page
    End If
   
    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.Rows(prs+1)(2).text = " 数量: " & sum1
    rt.Style.TextAlignVert = prt.AlignVertEnum.Center
    rt.Cells(prs+3,0).SpanCols = 4
    rt.Rows(prs+3)(0).text = " 白色  深红  浅蓝  浅黄   浅绿   浅红 "
    rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
    rt.Rows(prs+3)(0).Style.Font = New Font("宋体", 12, FontStyle.Bold)
    doc.Body.Children.Add(rt)
   
Next

doc.Preview


 回到顶部