Dim doc As New PrintDoc '定义一个报表
Dim rt As New prt.RenderText '定义一个文本对象
Dim ph, pw, pm, hn, hd, vn, vd As Double '定义纸长,纸宽,页边距、标签行数、行间距、列数、列间距
Doc.PageSetting.LeftMargin = pm '设置左边距
Doc.PageSetting.RightMargin = pm '设置右边距
Doc.PageSetting.TopMargin = pm '设置上边距
Doc.PageSetting.BottomMargin = pm '设置下边距
ph = 297
pw = 210
hn = 2
vn = 3
hd = 1
vd = 2
Dim lh, lw '定义标签的高度、宽度
lh = (ph - 2 * pm - (hn - 1) * vd) / vn
lw = (pw - 2 * pm - (vn - 1) * hd) / hn
Dim rtt As prt.RenderText '定义一个文本对象
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
For i As Integer = 1 To hn * vn
rtt = New prt.RenderText() '创建文本对象
rtt.Text = "Hello Foxtable " & i '设置文本对象的内容
rtt.Height = 95 '宽度毫米
rtt.Width = 99 '宽度毫米
rtt.Style.Spacing.left = vd '设置左边方向的间隔
rtt.Style.Spacing.top = hd '设置顶部方向的间隔
rtt.Style.Borders.All = New prt.Linedef(1, Color.Red) '设置边框
rtt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rtt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
doc.Body.Children.Add(rtt) '将文本对象加入到报表
Next
doc.Preview() '预览
此主题相关图片如下:x.png