Foxtable(狐表)用户栏目专家坐堂 → 打印变方向


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

主题:打印变方向

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


加好友 发短信
等级:八尾狐 帖子:1953 积分:15015 威望:0 精华:0 注册:2016/4/28 9:58:00
打印变方向  发帖心情 Post By:2017/10/27 9:03:00 [显示全部帖子]

Dim tbl As Table = Tables("初中报名_table4")
Dim dr As DataRow= tbl.DataTable.find("[考试室] is null")
If dr IsNot Nothing
    MessageBox.show("你的考试室设置没有完成,请设置好考试室再回来打印门牌")
Else
    Dim doc As New PrintDoc
    doc.PageSetting.Landscape = True
    Dim rt As Prt.RenderTable
    Dim rx As prt.RenderText
    Dim ColNames As String() = New String(){"年级","起始考号", "终止考号"}
    Dim Rows As List(Of DataRow)
    Dim Regions As List(Of String) = tbl.DataTable.GetValues("考试室") ''''改后句子
    Dim rm As prt.RenderEmpty
    Doc.PageSetting.LeftMargin = 20 '设置左边距
    Doc.PageSetting.RightMargin = 20 '设置右边距
    Doc.PageSetting.TopMargin = 50 '设置上边距
    Doc.PageSetting.BottomMargin = 10 '设置下边距
    For Each region As String In Regions
        rm = new prt.RenderEmpty '定义一个新的空对象
        rm.BreakBefore = prt.BreakEnum.Page '打印前换页
        doc.Body.Children.Add(rm)
        rx = New prt.RenderText
        rx.Style.Font = New Font("黑体", 120, FontStyle.Bold) '
        rx.Style.FontBold = True
        rx.Style.Spacing.Bottom = 2
        rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rx.Text =  Region
        doc.Body.Children.Add(rx)
        rt = New prt.RenderTable
        rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
        rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
        rt.Style.GridLines.All = New prt.LineDef(0.3,Color.black)
        rt.Style.Spacing.Bottom = 2
        rt.CellStyle.Spacing.All = 1
       ' rt.Height = 250
        rt.Style.Font = New Font("宋体", 40) '设置字体
        Rows = tbl.DataTable.Select("[考试室] = '" & region & "'")
        For c As Integer = 0 To ColNames.Length - 1 '
            For r As Integer = 0 To Rows.Count -1
                rt.Cells(r,c).Text = Rows(r)(ColNames(c))
            Next
           
        Next
        rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All
        doc.Body.Children.Add(rt)
    Next
       doc.preview()
End If

 

 

预览时是横向,一打印就成了纵向,请问是什么原因,怎么办?


 回到顶部