以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  报表  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=52707)

--  作者:gslxgl
--  发布时间:2014/6/20 21:14:00
--  报表

利用行组可以在下页有前几行作为表头使用,那么表格标题如何在每页显示呢


--  作者:gslxgl
--  发布时间:2014/6/20 22:11:00
--  

Dim doc As New PrintDoc \'定义一个新报表
Dim f As New prt.RenderText
 
Dim rt As New prt.RenderTable() \'

doc.PageSetting.PaperKind = 8 \'纸张类型改为B5
doc.PageSetting.Landscape = True
Doc.PageSetting.LeftMargin = 10 \'设置左边距
Doc.PageSetting.RightMargin = 10 \'设置右边距
Doc.PageSetting.TopMargin = 20 \'设置上边距
Doc.PageSetting.BottomMargin = 20 \'设置下边距
f.Width = "Auto" \'对象宽度等于页面宽度
f.Height = "Parent.Height" \'对象高度等于页面高度

 


Dim tb As Table = Tables("粮食直补")

rt.SplitHorzBehavior = prt.SplitBehaviorEnum.SplitIfNeeded \'表格宽度超出页宽时,可以水平换页
rt.Style.Font = tb.Font
For c As Integer = 0 To tb.Cols.Count -1 \'逐列设置和填入内容
    rt.Cells(0,c).Text = tb.Cols(c).Name \'列名作为标题
    rt.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'标题内容水平居中
    rt.Cols(c).Width = tb.Cols(c).PrintWidth \'列宽等于实际列宽
    If tb.Cols(c).IsNumeric OrElse tb.Cols(c).IsDate Then \'如果是数值或日期列
        rt.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.Right \'数据水平靠右
    End If
    For r As Integer = 0 To tb.Rows.Count -1 \'开始填入该列内容
        rt.Cells(r + 1, c).Text = tb(r,c)
    Next
Next
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray) \'灰色网格线
rt.CellStyle.Spacing.All = 0.5 \'单元格内距设为0.5毫米

 


 rt.Cells(0,0).text = "粮食直补表"
rt.Cells(0,0).SpanCols = 17 \'合并第一行全部单元格,用于显示主标题
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) \'去掉第一行的网格线
rt.Rows(0).Style.Borders.Bottom = New prt.Linedef  \'恢复第二行底端的网格线
rt.Rows(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'第一行内容水平居中
rt.RowGroups(0,2).Header = prt.TableHeaderEnum.All

 

 


 doc.Body.Children.Add(rt) \'将表格加入到报表

doc.Preview()

 

上述代码怎么不显示行标题啊


--  作者:gslxgl
--  发布时间:2014/6/20 22:52:00
--  
到底是那里错了
--  作者:gslxgl
--  发布时间:2014/6/21 6:18:00
--  
另外专业报表如何实现想打那列就打那弄的功能,比如有时打A列和B列,有时打B列和C列等
--  作者:Bin
--  发布时间:2014/6/21 8:50:00
--  
http://www.foxtable.com/help/topics/2735.htm

遍历行的时候控制一下遍历那些列即可.