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


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

主题:报表打印问题

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


加好友 发短信
等级:婴狐 帖子:5 积分:118 威望:0 精华:0 注册:2017/7/15 16:48:00
报表打印问题  发帖心情 Post By:2017/9/3 20:37:00 [只看该作者]

附件表格是以下代码产生的,行高度也设定了,为什么会是这种效果,请老师指教  

 

 

 

  Dim doc As New Printdoc  '定义一个报表
    Dim rx As prt.RenderText  '定义一个文本对象
    Dim rx1 As prt.RenderText  '定义一个文本对象
    Dim rt As prt.RenderTable  '定义一个表格对象
   
   
    '以下为标题设置
    Dim rt1 As New prt.RenderTable() '定义一个表格对象
    doc.Body.Children.Add(rt1) '将表格对象加入到报表中
    doc.PageSetting.PaperKind = 9 '纸张设置
    rt1.Style.GridLines.All = New prt.LineDef  '设置网格线
    rt1.CellStyle.Spacing.All = 1 '内容距离网格线1毫米
    '设置主标题
    rt1.Cells(0,0).text = "返 厂 维 修 申 请 单"
    rt1.Cells(0,0).SpanCols = 5 '合并第一行全部单元格,用于显示主标题
    rt1.Cells(0,0).Style.TextAlignHorz = prt.AlignHorzEnum.Center '主标题居中
    rt1.Cells(0,0).Style.Font = New Font("宋体", 16, FontStyle.Bold) '设置主标题字体
    rt1.Rows(0).Style.Borders.All = New prt.LineDef("0mm", Color.white) '去掉第一行的网格线
    rt1.Style.Spacing.Bottom = 5 '相邻对象的间隔
    '设置副标题
   

    rx = New prt.RenderText   '创建一个新的文本对象
    rx.Style.FontSize = 12   '设置字体大小
    'rx.Style.FontBold = True  '字体是否加粗
    rx.Style.Spacing.Bottom = 2 '相邻对象的间隔
    rx.Text ="申请单编号:" + sqdbh.text + "                                                         " + "日期: " + qdrq.text
    doc.Body.Children.Add(rx)
   
    rt = New prt.RenderTable
    rt.Style.GridLines.All = New prt.LineDef  '设置网格线
    rt.Style.FontSize = 11   '设置字体大小
   
    rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
    rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
    rt.Style.Borders.Bottom = New prt.LineDef(0.3,Color.LightGray) '恢复底端的网格线
    rt.CellStyle.Spacing.All = 1 '内容距离网格线1毫米
    rt.Cols.Count = 5 '设置列数
     
    rt.Cols(0).Width = 40 '设置列宽
    rt.Cols(1).Width = 30
    rt.Cols(2).Width = 30
    rt.Cols(3).Width = 30
    rt.Cols(4).Width = 30

    rt.Height = 80 '设置表格行高
    rt.Cells(0,0).Text = "识别码"
    rt.Cells(0,1).Text = "设备名称"
    rt.Cells(0,2).Text = "品牌"
    rt.Cells(0,3).Text = "型号"
    rt.Cells(0,4).Text = "备注"
   
   
     
    rt.rows(0).Style.Borders.Top = New prt.LineDef(0.5,Color.black)
    rt.rows(0).Style.Borders.Bottom = New prt.LineDef(0.5,Color.black)
   
    Tables("维修记录").Filter = "[报修单编号] = '"& sqdbh.text &"'"
   
    With Tables("维修记录")
       
        For r As Integer = 0 To .Rows.Count - 1 '遍历关联表每一行
           
            Dim sbbh As String = .rows(r)("设备编号")
            Dim drr As DataRow = DataTables("设备明细表").Find("设备编号 = '"& sbbh &"' ")
            If drr IsNot Nothing Then
                Dim sbm As String = drr("识别码")
                Dim pp As String = drr("品牌")
                Dim xh As String = drr("型号")
                Dim sbmc As String =drr("设备名称")
                rt.Cells(r+1,0).Text = sbm
                rt.Cells(r+1,1).Text = sbmc
                rt.Cells(r+1,2).Text = pp
                rt.Cells(r+1,3).Text = xh
                '        rt.Cells(r+1,7).Text = .rows(r)("备注")
            End If
        Next
        If  .Rows.Count < 5
           
            For r1 As Integer = .Rows.Count   To 5 '增加空行
                rt.Cells(r1+1,0).Text = ""
                rt.Cells(r1+1,1).Text = ""
                rt.Cells(r1+1,2).Text = ""
                rt.Cells(r1+1,3).Text = ""
                rt.Cells(r1+1,4).Text = ""
                '    Dim HJ As Integer = .rows(r)("单价") * .rows(r)("数量")
               
                '       rt.Cells(r1+1,7).Text = ""
                '        rt.Cells(r+1,7).Text = .rows(r)("备注")
            Next
           
        End If
       
       
       
    End With
   
   
   
   
   
   
    doc.Body.Children.Add(rt)
   
    rx = New prt.RenderText
    rx.Style.FontBold = True
    rx.Style.FontSize = 12   '设置字体大小
   
    rx.Style.Spacing.Top = 3
    'rx.Text = "数量: " & Tables("入库记录表.明细表").Rows.Count
    rx.Text = "负责人: " + "                            " + "机电科负责人: " + "                             " + " 申请人:" + cgr.text
    rx.Style.TextAlignHorz = prt.AlignHorzEnum.justify
    doc.Body.Children.Add(rx)
   
    doc.Preview
   


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20170903203308.png
图片点击可在新窗口打开查看

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/9/3 21:19:00 [只看该作者]

去掉代码 rt.Height = 80 '设置表格行高


 回到顶部
帅哥哟,离线,有人找我吗?
天空99
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:5 积分:118 威望:0 精华:0 注册:2017/7/15 16:48:00
  发帖心情 Post By:2017/9/3 21:29:00 [只看该作者]

谢谢老师,已解决

 回到顶部