以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 打印标题的问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=92064) |
-- 作者:天蝉一线 -- 发布时间:2016/10/25 13:23:00 -- 打印标题的问题 这是我的打印代码:执行后只有第一页有标题和副标题,以后各页就没有标题和副标题了,只有表格内容。我不知道代码怎么改了,麻烦您指导一下 Dim doc As New PrintDoc \'定义一个报表 Dim rt As New prt.RenderTable() \'定义一个表格对象 Dim rx As New prt.RenderText \'定义一个文本对象 Dim rz As New prt.RenderText \'定义一个文本对象 \'e.Form.Page.PaperKind = 8 \'纸张类型改为A4 \'e.Form.Page.Width = 250 \'纸张宽度为294毫米 \'e.Form.Page.Height = 210 \'纸张高度为210毫米 \'e.Form.Page.Landscape = True \'横向打印 e.Form.Page.LeftMargin = 20 \'设置左边距 e.Form.Page.RightMargin =20 \'设置右边距 e.Form.Page.TopMargin = 10 \'设置上边距 e.Form.Page.BottomMargin = 20 \'设置下边距 doc = e.Form.GernatePrintDoc() \'加入标题 rx.text = _Userdwmc & "大额资金支出上会提案表" rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 16 \'大体大小为16磅 rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中排列 rx.Style.Spacing.Bottom =3 \'和下面的对象(表格)距离3毫米 doc.Body.Children.Add(rx) \'加入到报表中 Dim rw As New prt.RenderArea Dim rn As prt.RenderText rw.Width = 250 \'宽度等于分栏宽度 rw.Height = 30 \'高度24毫米 rw.SplitHorzBehavior = prt.SplitBehaviorEnum.Never \'禁止水平分割 rw.SplitVertBehavior = prt.SplitBehaviorEnum.Never \'禁止垂直分割 rw.Style.Spacing.Bottom = 2 \' ra.Style.Borders.All = New prt.Linedef(0.3, Color.Red) \'设置边框 Doc.Body.ChildRen.Add(rw) \'将容器加入到报表中 rn = New prt.RenderText rn.Text = "过会提案编码:" rn.X = 2 rn.Y = 2 rw.Children.Add(rn) \'添加到容器中 rn = New prt.RenderText rn.Text = jlbh rn.X = 25 rn.Y = 2 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = "过会时间:" rn.X = 2 rn.Y = "Prev.Bottom + 2" \'垂直坐标位于迁移对象之下的2毫米 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = ghsj rn.X = 25 rn.Y = "Prev.Top" \'垂直坐标和前一对象相同 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = "过会类型:" rn.X = 2 rn.Y = "Prev.Bottom + 2" \'垂直坐标位于迁移对象之下的2毫米 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = ghlx rn.X = 25 rn.Y = "Prev.Top" \'垂直坐标和前一对象相同 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = "会议记录人:" rn.X = 2 rn.Y = "Prev.Bottom + 6" \'垂直坐标位于迁移对象之下的2毫米 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = hyjlr rn.X = 25 rn.Y = "Prev.Top" \'垂直坐标和前一对象相同 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = "会议主持人:" rn.X = 120 rn.Y = 2 rw.Children.Add(rn) \'添加到容器中 rn = New prt.RenderText rn.Text = hyzcr rn.X = 130 rn.Y = 2 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = "参加会议人员:" rn.X = 120 rn.Y = "Prev.Bottom + 6" rw.Children.Add(rn) \'添加到容器中 rn = New prt.RenderText rn.Text = cjhyry rn.X = 145 rn.Y = "Prev.Top" rw.Children.Add(rn) rn = New prt.RenderText rn.Text = "列席:" rn.X = 120 rn.Y = "Prev.Bottom + 8" rw.Children.Add(rn) \'添加到容器中 rn = New prt.RenderText rn.Text = lx rn.X = 145 rn.Y = "Prev.Top" rw.Children.Add(rn) Dim dt As DataTable Dim shjg As String = "审核通过" Dim g As New GroupTableBuilder("统计表1", DataTables("大额资金支出备案登记表"),"审核结果=\'" & shjg & "\'and 过会提案编码 = \'" & jlbh & "\'") g.Groups.AddDef("大额资金支付备案编码","大额资金支付备案编码") \'根据根据用户账号分组 g.Groups.AddDef("部门名称","申报部门名称") \'根据根据用户账号分组 g.Groups.AddDef("用户姓名","填报人") \'根据用户姓名分组 g.Groups.AddDef("付款单位账户名称","付款单位账户名称") \'根据用户姓名分组 g.Groups.AddDef("收款单位账户名称","收款单位账户名称") \'根据用户姓名分组 g.Groups.AddDef("支付性质","支付性质") \'根据用户姓名分组 g.Groups.AddDef("支付项目名称和内容","支付项目名称和内容") \'根据用户姓名分组 g.Groups.AddDef("支付金额","支付金额") \'根据用户姓名分组 g.Groups.AddDef("需要提前支付时间",DateGroupEnum.none,"提前支付时间") \'根据用户姓名分组 g.Groups.AddDef("提前支付理由","提前支付理由") \'根据用户姓名分组 g.Groups.AddDef("本单位过会时间",DateGroupEnum.none,"本单位过会时间")\'根据用户姓名分组 g.FromServer = True DT=g.build(True) dt.DataCols("提前支付时间").SetDateTimeFormat(DateTimeFormatEnum.DateTime) dt.DataCols("本单位过会时间").SetDateTimeFormat(DateTimeFormatEnum.DateTime) Dim rt1 As New prt.RenderTable Dim Count As Integer = 0 For Each Col As DataCol In Dt.DataCols rt1.Cells(0,Count).Text = Col.Name For r As Integer = 0 To dt.DataRows.Count - 1 rt1.Cells(r +1,Count).Text =dt.dataRows(r)(Col.Name) Next Count = Count + 1 Next rt1.Style.Gridlines.All = New prt.Linedef(Color.Gray) rt1.CellStyle.Spacing.All = 1 rt1.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center doc.Body.Children.Add(rt1) doc.Preview() |
-- 作者:有点蓝 -- 发布时间:2016/10/25 14:23:00 -- 参考:http://www.foxtable.com/webhelp/scr/2735.htm |
-- 作者:天蝉一线 -- 发布时间:2016/10/25 14:34:00 -- 我看了,还是加不上,麻烦您改一下! |
-- 作者:有点蓝 -- 发布时间:2016/10/25 15:22:00 -- 测试不了你的代码,下面代码自己看着改改 Dim doc As New PrintDoc \'定义一个报表 Dim rt As New prt.RenderTable() \'定义一个表格对象 Dim rx As New prt.RenderText \'定义一个文本对象 Dim rz As New prt.RenderText \'定义一个文本对象 \'e.Form.Page.PaperKind = 8 \'纸张类型改为A4 \'e.Form.Page.Width = 250 \'纸张宽度为294毫米 \'e.Form.Page.Height = 210 \'纸张高度为210毫米 \'e.Form.Page.Landscape = True \'横向打印 \'e.Form.Page.LeftMargin = 20 \'设置左边距 \'e.Form.Page.RightMargin =20 \'设置右边距 \'e.Form.Page.TopMargin = 10 \'设置上边距 \'e.Form.Page.BottomMargin = 20 \'设置下边距 \'doc = e.Form.GernatePrintDoc() \'加入标题 doc.Body.Children.Add(rt) \'加入到报表中 rt.Style.GridLines.All = New prt.Linedef \'设置网格线 rt.CellStyle.Spacing.All = 1 \'内容距离网格线1毫米 rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center rt.Cells(0,0).text = "大额资金支出上会提案表" rt.Cells(0,0).SpanCols = 6 \'合并第一行全部单元格,用于显示主标题 rt.Cells(0,0).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'主标题居中 rt.Cells(0,0).Style.Font = New Font("宋体", 16, FontStyle.Bold) \'设置主标题字体 rt.Rows(0).Style.Borders.All = New prt.LineDef("0mm", Color.white) \'去掉第一行的网格线 \'rx.text = "大额资金支出上会提案表" \'rx.Style.FontBold = True \'字体加粗 \'rx.Style.FontSize = 16 \'大体大小为16磅 \'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中排列 \'rx.Style.Spacing.Bottom =3 \'和下面的对象(表格)距离3毫米 Dim rw As New prt.RenderArea Dim rn As prt.RenderText rw.Width = 250 \'宽度等于分栏宽度 rw.Height = 30 \'高度24毫米 rw.SplitHorzBehavior = prt.SplitBehaviorEnum.Never \'禁止水平分割 rw.SplitVertBehavior = prt.SplitBehaviorEnum.Never \'禁止垂直分割 rw.Style.Spacing.Bottom = 2 \' ra.Style.Borders.All = New prt.Linedef(0.3, Color.Red) \'设置边框 \'Doc.Body.ChildRen.Add(rw) \'将容器加入到报表中 rn = New prt.RenderText rn.Text = "过会提案编码:" rn.X = 2 rn.Y = 2 rw.Children.Add(rn) \'添加到容器中 rn = New prt.RenderText rn.Text = "jlbh" rn.X = 25 rn.Y = 2 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = "过会时间:" rn.X = 2 rn.Y = "Prev.Bottom + 2" \'垂直坐标位于迁移对象之下的2毫米 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = "ghsj" rn.X = 25 rn.Y = "Prev.Top" \'垂直坐标和前一对象相同 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = "过会类型:" rn.X = 2 rn.Y = "Prev.Bottom + 2" \'垂直坐标位于迁移对象之下的2毫米 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = "ghlx" rn.X = 25 rn.Y = "Prev.Top" \'垂直坐标和前一对象相同 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = "会议记录人:" rn.X = 2 rn.Y = "Prev.Bottom + 6" \'垂直坐标位于迁移对象之下的2毫米 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = "hyjlr" rn.X = 25 rn.Y = "Prev.Top" \'垂直坐标和前一对象相同 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = "会议主持人:" rn.X = 120 rn.Y = 2 rw.Children.Add(rn) \'添加到容器中 rn = New prt.RenderText rn.Text = "hyzcr" rn.X = 130 rn.Y = 2 rw.Children.Add(rn) rn = New prt.RenderText rn.Text = "参加会议人员:" rn.X = 120 rn.Y = "Prev.Bottom + 6" rw.Children.Add(rn) \'添加到容器中 rn = New prt.RenderText rn.Text = "cjhyry" rn.X = 145 rn.Y = "Prev.Top" rw.Children.Add(rn) rn = New prt.RenderText rn.Text = "列席:" rn.X = 120 rn.Y = "Prev.Bottom + 8" rw.Children.Add(rn) \'添加到容器中 rn = New prt.RenderText rn.Text =" lx" rn.X = 145 rn.Y = "Prev.Top" rw.Children.Add(rn) rt.Cells(1,0).Area .Children.Add (rw) \'rt.Cells(1,1).text = "jlbh" rt.Cells(1,0).SpanCols = 6 \'合并第一行全部单元格,用于显示主标题 rt.Rows(1).Style.Borders.All = New prt.LineDef("0mm", Color.white) \'去掉第二行的网格线 rt.Rows(1).Style.Borders.Bottom = New prt.Linedef \'恢复第二行底端的网格线 rt.Rows(1).Height = 30 \'设置第二行的高度,拉开和表格主体的距离. Dim dt As DataTable Dim shjg As String = "审核通过" rt.RowGroups(0,2).Header = prt.TableHeaderEnum.All \'前四行作为表头 \'Dim g As New GroupTableBuilder("统计表1", DataTables("大额资金支出备案登记表"),"审核结果=\'" & shjg & "\'and 过会提案编码 = \'" & jlbh & "\'") \'g.Groups.AddDef("大额资金支付备案编码","大额资金支付备案编码") \'根据根据用户账号分组 \'g.Groups.AddDef("部门名称","申报部门名称") \'根据根据用户账号分组 \'g.Groups.AddDef("用户姓名","填报人") \'根据用户姓名分组 \'g.Groups.AddDef("付款单位账户名称","付款单位账户名称") \'根据用户姓名分组 \'g.Groups.AddDef("收款单位账户名称","收款单位账户名称") \'根据用户姓名分组 \'g.Groups.AddDef("支付性质","支付性质") \'根据用户姓名分组 \'g.Groups.AddDef("支付项目名称和内容","支付项目名称和内容") \'根据用户姓名分组 \'g.Groups.AddDef("支付金额","支付金额") \'根据用户姓名分组 \'g.Groups.AddDef("需要提前支付时间",DateGroupEnum.none,"提前支付时间") \'根据用户姓名分组 \'g.Groups.AddDef("提前支付理由","提前支付理由") \'根据用户姓名分组 \'g.Groups.AddDef("本单位过会时间",DateGroupEnum.none,"本单位过会时间")\'根据用户姓名分组 \'g.FromServer = True \'DT=g.build(True) \'dt.DataCols("提前支付时间").SetDateTimeFormat(DateTimeFormatEnum.DateTime) \'dt.DataCols("本单位过会时间").SetDateTimeFormat(DateTimeFormatEnum.DateTime) \'Dim rt1 As New prt.RenderTable Dim Count As Integer = 0 For i As Integer = 0 To 5 rt.Cells(2,i).Text = i For r As Integer = 2 To 100 rt.Cells(r +1,i).Text = r Next Next \'doc.Body.Children.Add(rt1) doc.Preview() |