为什么没有按序排列?
Dim doc As New PrintDoc
Doc.PageSetting.LeftMargin = 5 '设置左边距
Doc.PageSetting.RightMargin = 5 '设置右边距
Doc.PageSetting.TopMargin = 5 '设置上边距
Doc.PageSetting.BottomMargin = 5 '设置下边距
Dim rt As Prt.RenderTable
Dim rx As prt.RenderText
Dim rx1 As prt.RenderText
Dim tbl As Table = Tables("施工计划_Table1")
tbl.Sort = "作业顺序"
Dim ColNames As String() = New String(){"作业顺序", "工艺单编号", "加工内容_序号", "加工内容_工序", "加工内容_加工", "作业计划_作业人员", "作业计划_要求完成日期", "作业计划_估工" , "加工_实工", "加工_加工人", "检验确认", "钳工确认"}
Dim filter As String = "当天作业计划 = true"
Dim Rows As List(Of DataRow)
Dim Regions As List(Of String()) = tbl.DataTable.GetValues("加工内容_工序|作业计划_机床代号",tbl. filter)
doc.Pagesetting.LandScape = True
For Each Region As String() In Regions
Dim ra1 As New prt.RenderArea
ra1.SplitVertBehavior = prt.SplitBehaviorEnum.Never '禁止被垂直分割
Dim ra2 As New prt.RenderArea
ra2.SplitVertBehavior = prt.SplitBehaviorEnum.Never '禁止被垂直分割
ra2.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
rx = New prt.RenderText
rx.Width = 160 '宽度53毫米
rx.Height =8 '高度24毫米
rx.Style.FontSize = 12
rx.Style.Spacing.Bottom = 2
rx.Text = Region(0) & " / " & Region(1)
ra2.Children.Add(rx) '添加到容器中
rx1 = New prt.RenderText
rx1.Width = 120 '宽度53毫米
rx1.Height = 8 '高度24毫米
rx1.Style.FontSize = 10
rx1.Style.Spacing.Bottom = 2
rx1.Text = "日期: " & Today
rx1.Style.TextAlignHorz = prt.AlignHorzEnum.Right
rx1.Style.TextAlignVert = prt.AlignVertEnum.Bottom '垂直居中
ra2.Children.Add(rx1) '添加到容器中
ra1.Children.Add(ra2)
rt = New prt.RenderTable
rt.Style.Font = Tables("施工计划_Table1").Font
rt.Style.TextAlignVert = prt.AlignVertEnum.Center
rt.Style.GridLines.All = New prt.LineDef(0.3,Color.LightGray)
rt.Style.Spacing.Bottom = 5
rt.CellStyle.Spacing.All = 1
rt.Style.Font = tbl.Font
Rows = tbl.DataTable.Select("[作业计划_机床代号] = '" & Region(1) & "' and " & filter)
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.Cells(0,5).Text = "数量"
rt.Cells(0,6).Text = "工艺单编号"
rt.Cells(0,7).Text = "序号"
rt.Cells(0,8).Text = "工序"
rt.Cells(0,9).Text = "加工内容"
rt.Cells(0,10).Text = "作业人员"
rt.Cells(0,11).Text = "要求完成时间"
rt.Cells(0,12).Text = "估工"
rt.Cells(0,13).Text = "实工"
rt.Cells(0,14).Text = "作业确认"
rt.Cells(0,15).Text = "检验确认"
rt.Cells(0,16).Text = "钳工确认"
For r As Integer = 0 To Rows.Count -1 '开始填入该列内容
rt.Cols(0).Width = 20
rt.Cols(1).Width = 30
rt.Cols(2).Width = 35
rt.Cols(3).Width = 60
rt.Cols(4).Width = 60
rt.Cols(5).Width = 20
rt.Cols(6).Width = 45
rt.Cols(7).Width = 20
rt.Cols(8).Width = 30
rt.Cols(9).Width = 120
rt.Cols(10).Width = 35
rt.Cols(11).Width = 40
rt.Cols(12).Width = 20
rt.Cols(13).Width = 20
rt.Cols(14).Width = 25
rt.Cols(15).Width = 35
rt.Cols(16).Width = 35
Dim fdr As DataRow = DataTables("任务单").Find("任务单编号 = '" & Rows(r)("工艺单编号").split("-")(0) & "'")
If fdr IsNot Nothing Then
rt.Cells(r + 1, 1).Text = fdr("任务单编号")
rt.Cells(r + 1, 2).Text = fdr("工装模具编号")
rt.Cells(r + 1, 3).Text = fdr("产品名称")
End If
Dim fdr1 As DataRow = DataTables("工艺单").Find("工艺单编号 = '" & Rows(r)("工艺单编号") & "'")
If fdr1 IsNot Nothing Then
rt.Cells(r + 1, 4).Text = fdr1("零件名称")
rt.Cells(r + 1, 5).Text = fdr1("零件数量")
End If
Next
For c As Integer = 1 To ColNames.Length - 1 '逐列设置和填入内容
For r As Integer = 0 To Rows.Count -1 '开始填入该列内容
If tbl.Cols(ColNames(c)).IsNumeric AndAlso Rows(r)(ColNames(c)) = 0 Then
rt.Cells(r + 1, c+5).Text = ""
Else
rt.Cells(r + 1, c+5).Text = Rows(r)(ColNames(c))
rt.Cells(r + 1, 0).Text = Rows(r)(ColNames(0))
End If
Next
Next
rt.RowGroups(0,6).Header = prt.TableHeaderEnum.All
ra1.Children.Add(rt)
doc.Body.Children.Add(ra1)
Next
doc.preview()
此主题相关图片如下:1559.png