Foxtable(狐表)用户栏目专家坐堂 → 请教:分组打印


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

主题:请教:分组打印

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


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

Dim doc As New PrintDoc
Dim rt As Prt.RenderTable
Dim rx As prt.RenderText
Dim tbl As Table = Tables("吊弦计算")
Dim Rows As List(Of DataRow)
Dim Datas As List(Of String()) = tbl.DataTable.GetValues("工程名称|单位工程名称|锚段",tbl.Filter)
doc.Pagesetting.LandScape = True
For Each Data As String() In Datas
    rx = New prt.RenderText
    rx.Style.FontSize = 16
    rx.Style.FontBold = True
    rx.Style.Spacing.Bottom = 5
    rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '文本内容水平居中
    rx.Text = "吊 弦 计 算 单"
    doc.Body.Children.Add(rx)
   
    rx = New prt.RenderText
    rx.Style.FontSize = 10
    rx.Style.FontBold = False
    rx.Style.Spacing.Bottom = 2
    rx.Text = "项目: " & Data(0) & "    站区: " & Data(1) & "    锚段: " & data(2)
    doc.Body.Children.Add(rx)
   
    rt = New prt.RenderTable
    rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
    Rows = tbl.DataTable.Select("[工程名称] = '" & Data(0)& "' and [单位工程名称] = '" & Data(1)& "' and [锚段] = '" & Data(2)& "'")
    'rt.Width = 180 '表宽为150毫米
    'rt.Height = 30 '表高为150毫米
    'rt.Rows.Count = 4 '设置行数
    'rt.Cols.Count = 12 '设置列数
    rt.Cells(0, 0).text = "左支柱"
    rt.Cells(0, 1).text = ""
    rt.Cells(0, 2).text = "吊弦1"
    rt.Cells(0, 3).text = "吊弦2"
    rt.Cells(0, 4).text = "吊弦3"
    rt.Cells(0, 5).text = "吊弦4"
    rt.Cells(0, 6).text = "吊弦5"
    rt.Cells(0, 7).text = "吊弦6"
    rt.Cells(0, 8).text = "吊弦7"
    rt.Cells(0, 9).text = "吊弦8"
    rt.Cells(0, 10).text = "右支柱"
    rt.Cells(0, 11).text = "备注"
   
    For r As Integer = 0 To Rows.Count -1
        Dim dr As DataRow = Rows(r)
       
        Dim i As Integer = r*3+1
        rt.Cells(1+i, 0).text = dr("左支柱")
        rt.Cells(1+i, 1).text = "间距"
        rt.Cells(1+i, 2).text = Format(dr("间距1"),"0.00")
        rt.Cells(1+i, 3).text = Format(dr("间距2"),"0.00")
        rt.Cells(1+i, 4).text = Format(dr("间距3"),"0.00")
        rt.Cells(1+i, 5).text = Format(dr("间距4"),"0.00")
        rt.Cells(1+i, 6).text = Format(dr("间距5"),"0.00")
        rt.Cells(1+i, 7).text = Format(dr("间距6"),"0.00")
        rt.Cells(1+i, 8).text = Format(dr("间距7"),"0.00")
        rt.Cells(1+i, 9).text = Format(dr("间距8"),"0.00")
        rt.Cells(1+i, 10).text = dr("右支柱")
        rt.Cells(2+i, 1).text = "吊弦长度"
        rt.Cells(2+i, 2).text = Format(dr("吊弦1长"),"0")
        rt.Cells(2+i, 3).text = Format(dr("吊弦2长"),"0")
        rt.Cells(2+i, 4).text = Format(dr("吊弦3长"),"0")
        rt.Cells(2+i, 5).text = Format(dr("吊弦4长"),"0")
        rt.Cells(2+i, 6).text = Format(dr("吊弦5长"),"0")
        rt.Cells(2+i, 7).text = Format(dr("吊弦6长"),"0")
        rt.Cells(2+i, 8).text = Format(dr("吊弦7长"),"0")
        rt.Cells(2+i, 9).text = Format(dr("吊弦8长"),"0")
        rt.Cells(3+i, 1).text = "加工长度"
        rt.Cells(3+i, 2).text = Format(dr("吊弦1加工长"),"0")
        rt.Cells(3+i, 3).text = Format(dr("吊弦2加工长"),"0")
        rt.Cells(3+i, 4).text = Format(dr("吊弦3加工长"),"0")
        rt.Cells(3+i, 5).text = Format(dr("吊弦4加工长"),"0")
        rt.Cells(3+i, 6).text = Format(dr("吊弦5加工长"),"0")
        rt.Cells(3+i, 7).text = Format(dr("吊弦6加工长"),"0")
        rt.Cells(3+i, 8).text = Format(dr("吊弦7加工长"),"0")
        rt.Cells(3+i, 9).text = Format(dr("吊弦8加工长"),"0")
        rt.Cells(1+i,0).SpanRows = 3 '第2行第1个单元格向下合并3行
        rt.Cells(1+i,10).SpanRows = 3 '第2行第11个单元格向下合并3行
        rt.Cells(1+i,11).SpanRows = 3 '第2行第12个单元格向下合并3行
        rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '所有文本内容居中
        rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
    Next
   
   
    rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All
    doc.Body.Children.Add(rt)
Next
Doc.PageSetting.LeftMargin = 15 '设置左边距
Doc.PageSetting.RightMargin = 15 '设置右边距
Doc.PageSetting.TopMargin = 15 '设置上边距
Doc.PageSetting.BottomMargin = 10 '设置下边距
doc.PageSetting.Width = 210 '纸张宽度为100毫米
doc.PageSetting.Height = 297 '纸张高度为120毫米
doc.preview()

 回到顶部