你的问题不知一点点,你学了很多,但是有些概念还是模糊,我建议您按顺序系统学习帮助文件,这样才能理解,理解了才能灵活运用。
稍微改了一下:
Dim doc As New PrintDoc '定义一个报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
Dim rte As prt.RenderText '定义一个文本对象
rte = New prt.RenderText
rte.Text = "生产计划通知单" '设置文本对象的内容
rte.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rte.Style.Spacing.Bottom = 5 '设置下间隔为3毫米
rte.Style.Font = New Font("宋体", 16, FontStyle.Bold)
doc.Body.Children.Add(rte) '将文本对象加入到报表
'设置水印
rte = New prt.RenderText '设置文本对象的内容
rte.Text = "海盐三马标准件有限公司生产计划通知单" '设置文本内容
rte.Width = "Parent.Width" '宽度等于页面宽度
rte.Height = "Parent.Height" '高度等于页面高度
rte.Style.TextAngle = 45 '旋转45度
rte.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中对齐
rte.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中对齐
rte.Style.FontSize = 27 '字体大小为8磅
rte.Style.TextColor = Color.Gray '文本颜色为灰色
Doc.WaterMark = rte '作为页眉使用
Dim rta As New prt.RenderTable
rte = New prt.RenderText
rte.Style.FontSize = 14
rte.Style.FontBold = True
rte.Style.Spacing.Bottom = 2
rte.Text = "合同编号: " & Tables("订单表").Current("编号")
doc.Body.Children.Add(rte)
rte = New prt.RenderText
rte.y = "Prev.Bottom - 8"
rte.x = "Prev.Bottom + 70"
rte.Style.FontSize = 14
rte.Style.FontBold = True
rte.Style.Spacing.Bottom = 2
rte.Text = "原合同号: " & Tables("订单表").Current("合同号")
doc.Body.Children.Add(rte)
rte = New prt.RenderText
rte.Style.FontSize = 14
rte.Style.FontBold = True
rte.Style.Spacing.Bottom = 2
rte.Text = "客户编号: " & Tables("订单表").Current("客户编号")
doc.Body.Children.Add(rte)
rte = New prt.RenderText
rte.y = "Prev.Bottom - 8"
rte.x = "Prev.Bottom + 63"
rte.Style.FontSize = 14
rte.Style.FontBold = True
rte.Style.Spacing.Bottom = 2
rte.Text = "客户简称: " & Tables("订单表").Current("客户简称")
doc.Body.Children.Add(rte)
rte = New prt.RenderText
rte.Style.FontSize = 14
rte.Style.FontBold = True
rte.Style.Spacing.Bottom = 2
rte.Text = "交期: " & Tables("订单表").Current("交期")
doc.Body.Children.Add(rte)
rte = New prt.RenderText
rte.y = "Prev.Bottom - 8"
rte.x = "Prev.Bottom + 55"
rte.Style.FontSize = 14
rte.Style.FontBold = True
rte.Style.Spacing.Bottom = 2
rte.Text = "总金额: " & Tables("订单表").Current("金额")
doc.Body.Children.Add(rte)
Dim tbl As Table = Tables("订单表.订单明细表")
Dim Rows As List(Of DataRow)
Dim Regions As List(Of String) = tbl.DataTable.GetUniqueValues("编号 = '" & Tables("订单表").Current("编号") & "'","名称")
doc.Pagesetting.LandScape = True
For Each Region As String In Regions
rte= New prt.RenderText
rte.Style.FontSize = 14
rte.Style.FontBold = True
rte.Style.Spacing.Bottom = 2
rte.Text = "名称: " & Region
doc.Body.Children.Add(rte)
rta = New prt.RenderTable
rta.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rta.Style.TextAlignVert = prt.AlignVertEnum.Center
rta.Style.Borders.Bottom = New prt.LineDef(0.3,Color.LightGray)
rta.CellStyle.Spacing.All = 1
rta.Cols.Count = 4
rta.Cells(0,0).Text = "规格"
rta.Cells(0,1).Text = "数量"
rta.Cells(0,2).Text = "单位"
rta.Cells(0,3).Text = "业务科录入_头标"
rta.Cells(0,4).Text = "凹凸"
rta.Cells(0,5).Text = "对边对角"
rta.Cells(0,6).Text = "要求材质"
rta.Cells(0,7).Text = "线径"
rta.Cells(0,8).Text = "线材所需"
rta.rows(0).Style.Borders.Top = New prt.LineDef(1,Color.LightGray)
rta.rows(0).Style.Borders.Bottom = New prt.LineDef(1,Color.LightGray)
Rows = tbl.DataTable.Select("[名称] = '" & Region & "' And 编号 = '" & Tables("订单表").Current("编号") & "'")
For r As Integer = 0 To Rows.Count - 1 '遍历关联表每一行
rta.Cells(r+1,0).Text = rows(r)("规格")
rta.Cells(r+1,1).Text = rows(r)("数量")
rta.Cells(r+1,2).Text = rows(r)("单位")
rta.Cells(r+1,3).Text = rows(r)("业务科录入_头标")
rta.Cells(r+1,6).Text = rows(r)("要求材质")
rta.Cells(r+1,7).Text = rows(r)("线径")
rta.Cells(r+1,8).Text = rows(r)("线材所需")
If rows(r)("凹凸") = True Then
rte = New prt.RenderText
rte.text = "凹"
rta.Cells(r+1,5).RenderObject = rte
Else
rte = New prt.RenderText
rte.text = "凸"
rta.Cells(r+1,5).RenderObject = rte
End If
Next
doc.Body.Children.Add(rta)
Next
rte= New prt.RenderText
rte.Style.FontBold = True
rte.Style.Spacing.Top = 3
rte.Text = "产品数目: " & Tables("订单表.订单明细表").Rows.Count
rte.Style.TextAlignHorz = prt.AlignHorzEnum.Right
doc.Body.Children.Add(rte)
doc.Preview
[此贴子已经被作者于2013-3-1 9:41:55编辑过]