'页面设置
Dim doc As New PrintDoc '定义一个报表
Doc.PageSetting.LeftMargin = 15
Doc.PageSetting.BottomMargin = 15
Doc.PageSetting.TopMargin = 15
Doc.PageSetting.rightMargin = 15
Dim rx8 As prt.RenderText
'设置二级标题
rx8 = New prt.RenderText
rx8.Style.Font = New Font("宋体", 16)
rx8.Style.Spacing.Bottom = 3
Dim dr As String = Forms("mainform").controls("劳保发放企业名称").value
rx8.text = dr & vbcrlf & "劳动防护用品发放记录" '表标题显示企业名称
rx8.Style.TextAlignHorz = prt.AlignHorzEnum.Center '标题水平居中
doc.Body.Children.Add(rx8)
Dim rt As New prt.RenderTable '定义一个新表格
rt.Rows.Count = 24 '设置总行数
rt.Height = 240 '设置表格的高度
rt.Cols(0).Width = 13 '设置列的宽度
rt.Cols(1).Width = 62
rt.Cols(2).Width = 10
rt.Cols(3).Width = 15
Dim ColNames As String() = New String(){"发放日期","劳动防护用品名称","数量","领取人签字"}
rt.Style.Font = New Font("仿宋", 13)
For c As Integer = 0 To ColNames.Length - 1 '逐列设置和填入内容
rt.Cells(0,c).Text = ColNames(c) '列名作为标题
rt.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center '标题内容水平居中
rt.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.center '数据水平靠右
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
Next
rt.Style.Gridlines.All = New prt.Linedef(Color.black) '灰色网格线
rt.CellStyle.Spacing.All = 0.5 '单元格内距设为0.5毫米
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center '第一行内容水平居中
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All '利用行组,将第一行设为表头.
doc.Body.Children.Add(rt) '将表格加入到报表
doc.Preview()
如何向表B的第二列填充表A不为空列的列名,不会写代码,请老师帮忙,谢谢!