Dim doc As New PrintDoc
doc.PageSetting.Width = 102 '纸张宽度为100毫米
doc.PageSetting.Height = 75 '纸张高度为120毫米
Dim rt As Prt.RenderTable
Dim rx As prt.RenderText
Dim tbl As Table = Tables("装箱单")
Dim Rows As List(Of DataRow)
Dim Regions As List(Of String) = tbl.DataTable.GetValues("PLTNO")
doc.Pagesetting.LandScape = False
For Each Region As String In Regions
rx = New prt.RenderText
rx.Style.FontSize = 14 '字体大小
rx.Style.FontBold = True ' 字体加粗
rx.Style.Spacing.Bottom = 2 '底端内容缩进
rx.Text = "ITEM NO.:" & e.Form.Controls("name").text
doc.Body.Children.Add(rx)
rt = New prt.RenderTable
rt.Style.Font = Tables("装箱单").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 '内容距离网格线1毫米
rt.Style.Font = tbl.Font
Rows = tbl.DataTable.Select("[PLTNO] = '" & Region & "'")
For c As Integer = 1 To tbl.Cols.Count - 1 '从第二列起
rt.Cells(1,c).Text = tbl.Cols(c).Name '从第二行起
rt.Cols(c).Width = tbl.Cols(c).PrintWidth
For r As Integer = 0 To Rows.Count -1
rt.Cells(r + 1, c).Text = rows(r)(tbl.Cols(c).Name)
Next
Next
rx = New prt.RenderText
rx.Style.FontBold = True
rx.Style.Spacing.Top = 3
rx.Text = "C/NO.:" & Region
rx.Style.TextAlignHorz = prt.AlignHorzEnum.left
doc.Body.Children.Add(rx)
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All
doc.Body.Children.Add(rt)
Next
doc.preview()
此主题相关图片如下:x1.png
![dvubb 图片点击可在新窗口打开查看](UploadFile/2016-6/201662910474599778.png)
本想做个标签分组打印,以图上数据,本应只打印两页的标签,却分了7页打!求指点!
此主题相关图片如下:x2.png
![dvubb 图片点击可在新窗口打开查看](UploadFile/2016-6/201662910533022042.png)
[此贴子已经被作者于2016/6/29 10:53:31编辑过]