以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  专业报表的多层表头+分页控制+插入行列号要做?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=29643)

--  作者:晕了快扶我
--  发布时间:2013/3/11 10:35:00
--  专业报表的多层表头+分页控制+插入行列号要做?

闹半天没整明白,谁帮忙写下

CaseStudy目录下的文件:统计演示.Table

如果是多层表头,可以采用下面的代码:

Dim doc As New PrintDoc
Dim
tb As Table = Tables("订单")
Dim
prs As Integer = 20 \'每页20行
For
p As Integer = 0 To math.Ceiling(tb.Rows.Count / prs) - 1
    Dim
rt As New prt.RenderTable
    rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
    rt.CellStyle.Spacing.All =
0.5
    tb.CreateReportHeader(rt,
False) \'生成多层表头
   
For c As Integer = 0 To tb.Cols.Count - 1
       
For r As Integer = p * prs To math.min(tb.Rows.Count - 1,( p + 1) * prs - 1)
            rt.Cells(r - p * prs + tb.HeaderRows, c).Text = tb.rows(r)(c)

        Next
    Next
    If
p < math.Ceiling(tb.Rows.Count / prs) - 1
        rt.BreakAfter = prt.BreakEnum.Page

    End
If
    doc.Body.Children.Add(rt)

Next

doc.Preview()

 

 

如果要打印行号列,可以参考下面的代码:

 

rt.Cols.Insert(0) \'在左边插入一列,用于打印行号
rt.Cols(
0).Width = 10 \'设置行号列的宽度
For
i As Integer = 1 To rt.Rows.Count - 1
   
rt.Cells(i,0).text = i \'逐行写入行号
Next

 

插入行列号不知道该放哪才对,求指点