此主题相关图片如下:标签1.png
此主题相关图片如下:标签2.png
以下是代码,抄帮助的
Dim doc As New PrintDoc() '定义一个报表
doc.PageSetting.Width = 159 '纸张宽度为100毫米
doc.PageSetting.Height = 205 '纸张高度为120毫米
Doc.PageSetting.LeftMargin = 0.5 '设置左边距
Doc.PageSetting.RightMargin = 0.5 '设置右边距
Doc.PageSetting.TopMargin = 3.5 '设置上边距
Doc.PageSetting.BottomMargin = 0.5 '设置下边距
Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
For i As Integer = 0 To 39
Dim ra As New prt.RenderArea
Dim rt As prt.RenderText
ra.Width = 39.4 '宽度53毫米
ra.Height = 20 '高度24毫米
ra.Style.Spacing.All = 0.5
ra.Style.Borders.All = New prt.Linedef(0.1, Color.Red) '设置边框
ra.SplitHorzBehavior = prt.SplitBehaviorEnum.Never '禁止水平分割
ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never '禁止垂直分割
Doc.Body.ChildRen.Add(ra) '将容器加入到报表中
rt = New prt.RenderText
rt.Text = "姓名:"
rt.X = 2
rt.Y = 2
ra.Children.Add(rt) '添加到容器中
rt = New prt.RenderText
rt.Text = "黄财德"
rt.X = 15
rt.Y = 2
ra.Children.Add(rt)
rt = New prt.RenderText
rt.Text = "职务:"
rt.X = 2
rt.Y = "Prev.Bottom + 2" '垂直坐标位于迁移对象之下的2毫米
ra.Children.Add(rt)
rt = New prt.RenderText
rt.Text = "总经理"
rt.X = 15
rt.Y = "Prev.Top" '垂直坐标和前一对象相同
ra.Children.Add(rt)
rt = New prt.RenderText
rt.Text = "编号:"
rt.X = 2
rt.Y = "Prev.Bottom + 2"
ra.Children.Add(rt)
rt = New prt.RenderText
rt.Text = "44081919710917243"
rt.X = 15
rt.Y = "Prev.Top"
ra.Children.Add(rt)
Next
doc.Preview '预览
[此贴子已经被作者于2022/5/13 14:05:38编辑过]