Dim doc As New PrintDoc
Dim rt As Prt.RenderTable
Dim rx As prt.RenderText
Dim Rows As List(of Row) = Tables("学生信息").GetCheckedRows()
Dim rm As prt.RenderEmpty
Doc.PageSetting.LeftMargin = 5 '设置左边距
Doc.PageSetting.RightMargin = 5 '设置右边距
Doc.PageSetting.TopMargin = 10 '设置上边距
Doc.PageSetting.BottomMargin = 10 '设置下边距
rm = new prt.RenderEmpty '定义一个新的空对象
doc.Body.Children.Add(rm)
rt = New prt.RenderTable
rt.Cols(0).Width = 42
rt.Cols(1).width = 50
rt.Cols(2).Width = 42
rt.Cols(3).width = 50
rt.Style.Spacing.Bottom = 2
rt.CellStyle.Spacing.All = 1
Dim i As Integer
Dim j As Integer
For r As Integer= 0 To Rows.Count-1
Dim l As Integer = r Mod 2
If Rows(r)("就读方式")= "住校"
rt.Style.TextColor = Color.Red
Else
rt.style.textcolor = Color.blue
End If
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居
rt.Rows((math.ceiling(r\2))*4).Height=13
rt.Rows((math.ceiling(r\2))*4+1).Height=13
rt.Rows((math.ceiling(r\2))*4+2).Height=13
rt.Rows((math.ceiling(r\2))*4+3).Height=13
rt.Style.GridLines.All = New Prt.LineDef(0.1, Color.Black)
rt.Style.GridLines.Horz = new Prt.LineDef(Color.white)
rt.Style.GridLines.Vert = new Prt.LineDef(Color.white)
rt.Style.Font = New Font("黑体", 16, FontStyle.Bold) '
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '
rt.Cells((math.ceiling(r\2))*4, 2*l).Text = Rows(r)("学校名称")
rt.Style.Font = New Font("宋体", 15, FontStyle.Bold)
rt.Style.TextAlignHorz = prt.AlignHorzEnum.left
rt.Style.TextAlignVert = prt.AlignVertEnum.Center
rt.Cells((math.ceiling(r\2))*4+1, 3^l).Text = "姓名:" & Rows(r)("学生姓名")
rt.Cells((math.ceiling(r\2))*4+2, 3^l).Text = "班级:" & Rows(r)("班级")
rt.Cells((math.ceiling(r\2))*4+3, 3^l).Text = "备注:" & Rows(r)("就读方式")
rt.Cells((math.ceiling(r\2))*4+1,2*l).Image = GetImage(projectPath & "attachments/" & Rows(r)("相片"))
rt.Cells((math.ceiling(r\2))*4,2*l).SpanCols = 2
rt.Cells((math.ceiling(r\2))*4+1,2*l).Spanrows = 3
Next
doc.Body.Children.Add(rt)
doc.preview()
老师,现在还个问题,我是想 rt.Cells((math.ceiling(r\2))*4, 2*l).Text = Rows(r)("学校名称")的内容在表格里居中,字号大一点用黑体,单独设格式,
rt.Cells((math.ceiling(r\2))*4+1, 3^l).Text = "姓名:" & Rows(r)("学生姓名")
rt.Cells((math.ceiling(r\2))*4+2, 3^l).Text = "班级:" & Rows(r)("班级")
rt.Cells((math.ceiling(r\2))*4+3, 3^l).Text = "备注:" & Rows(r)("就读方式")
这三个内容表格靠左对齐
另外如果记录中为走校时用蓝色字,住校时用红色字,按上面做做部是红色,单独如何设置某单元格的字体字号呢?