Dim ra As New prt.RenderArea
doc.PageSetting.Width = 60
doc.PageSetting.Height = 40
Doc.PageSetting.LeftMargin = 0 '设置左边距
Doc.PageSetting.RightMargin = 0 '设置右边距
Doc.PageSetting.TopMargin = 0 '设置上边距
Doc.PageSetting.BottomMargin = 0 '设置下边距
ra.Width = "Parent.Width"
ra.Height = "Parent.Height"
doc.Body.Children.Add(ra)
Dim rt As prt.RenderText '定义一个文本对象
rt = New prt.RenderText() '创建文本对象
rt.Text = "合格证" '设置文本对象的内容
rt.Width = "Auto" '自动设置宽度
rt.Style.Font = New Font("宋体", 16, FontStyle.Bold) '设置字体
rt.X = 22 '指定水平位置
rt.y = 3 '指定垂直位置
doc.Body.Children.Add(rt) '将文本对象加入到报表
rt = New prt.RenderText() '创建文本对象
rt.Text = "品名:" & txt '设置文本对象的内容
rt.Width = "Auto" '自动设置宽度
rt.Style.Font = New Font("宋体", 12, FontStyle.Bold) '设置字体
rt.X = 2 '指定水平位置
rt.y = 10 '指定垂直位置
doc.Body.Children.Add(rt) '将文本对象加入到报表
rt = New prt.RenderText() '创建文本对象
rt.Text = "规格:" & txt2 '设置文本对象的内容
rt.Width = "Auto" '自动设置宽度
rt.Style.Font = New Font("宋体", 12, FontStyle.Bold) '设置字体
rt.X = 2 '指定水平位置
rt.y = 16 '指定垂直位置
doc.Body.Children.Add(rt) '将文本对象加入到报表
rt = New prt.RenderText() '创建文本对象
rt.Text = "数量:" & txt3 '设置文本对象的内容
rt.Width = "Auto" '自动设置宽度
rt.Style.Font = New Font("宋体", 12, FontStyle.Bold) '设置字体
rt.X = 2 '指定水平位置
rt.y = 22 '指定垂直位置
doc.Body.Children.Add(rt) '将文本对象加入到报表
rt = New prt.RenderText() '创建文本对象
rt.Text = "日期:" & txt5 '设置文本对象的内容
rt.Width = "Auto" '自动设置宽度
rt.Style.Font = New Font("宋体",12, FontStyle.Bold) '设置字体
rt.X = 2 '指定水平位置
rt.y = 28'指定垂直位置
doc.Body.Children.Add(rt) '将文本对象加入到报表
rt = New prt.RenderText() '创建文本对象
rt.Text = "品检员:" & txt4 '设置文本对象的内容
rt.Width = "Auto" '自动设置宽度
rt.Style.Font = New Font("宋体",12, FontStyle.Bold) '设置字体
rt.X = 2 '指定水平位置
rt.y = 34 '指定垂直位置
doc.Body.Children.Add(rt) '将文本对象加入到报表
Doc.PageSetting.ToPageSettings.PrinterSettings.Copies = n
doc.Print()