以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 表标题问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=92271) |
-- 作者:刘林 -- 发布时间:2016/10/30 21:22:00 -- 表标题问题 Dim doc As New PrintDoc Dim rt As Prt.RenderTable Dim rx As prt.RenderText Dim tbl As Table = Tables("打印考试用表_table1") Dim ColNames As String() = New String(){"考号", "姓名"} Dim Rows As List(Of DataRow) Dim Regions As List(Of String()) = tbl.DataTable.GetValues("考试名称|单位名称|年级代码|班级") \'\'\'\'改后句子 Dim rm As prt.RenderEmpty Doc.PageSetting.LeftMargin = 10 \'设置左边距 Doc.PageSetting.RightMargin = 10 \'设置右边距 Doc.PageSetting.TopMargin = 10 \'设置上边距 Doc.PageSetting.BottomMargin = 10 \'设置下边距 tbl.sort = "班级,考号" For Each region As String() In Regions rm = new prt.RenderEmpty \'定义一个新的空对象 rm.BreakBefore = prt.BreakEnum.Page \'打印前换页 doc.Body.Children.Add(rm) rx = New prt.RenderText rx.Style.FontSize = 14 rx.Style.FontBold = True rx.Style.Spacing.Bottom = 2 rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center rx.Text = Region(1) & Region(0) & Region(2) & "级" & Region(3) & "班考号表" doc.Body.Children.Add(rx) rt = New prt.RenderTable rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中 rt.Style.GridLines.All = New prt.LineDef(0.3,Color.black) rt.Style.Spacing.Bottom = 2 rt.CellStyle.Spacing.All = 1 rt.Style.Font = New Font("宋体", 12, FontStyle.Bold) \'设置字体 Rows = tbl.DataTable.Select("[单位名称] = \'" & region(1) & "\'and [班级] =\'" & region(3) & "\'and [年级代码] =\'" & region(2) & "\'and [考试名称] =\'" & region(0) & "\'") For c As Integer = 0 To ColNames.Length - 1 \'逐列设置和填入内 rt.Cells(1,c).Text = ColNames(c) \'列名作为标题 rt.Cells(1,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center For r As Integer = 0 To Rows.Count -1 rt.Cells(r+1,c).Text = Rows(r)(ColNames(c)) rt.Rows(r+1).Height = 10 Next Next rt.RowGroups(0,2).Header = prt.TableHeaderEnum.All doc.Body.Children.Add(rt) Next doc.Columns.Add() doc.Columns.Add() doc.Columns.Add() doc.preview() 老师,你好我想做一个分班考号表,想在一张纸上打印一个班的考号,分了三栏,红色为页标题,现在问题是该标题只显在了第一栏前面,我是想页标题显示在页正上方中间,三栏在下面并列,研究没找出办法,请指导,谢谢 XX学校XX考试XX级XX班考号 第一栏 第二栏 第三栏 |
-- 作者:有点蓝 -- 发布时间:2016/10/31 10:06:00 -- 分栏的情况下没有办法做到这种效果,只能没栏都出现 或者改下方式,不用分栏,改成3个表格显示
|