Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:报表

1楼
cjl333333333 发表于:2023/11/23 13:09:00
Dim rt As New prt.RenderTable '定义一个新表格
Dim tb As Table = Tables("集控表")
Dim hd As Integer = tb.HeaderRows '获得表头的层数
Dim cnt As Integer '用于记录列位置
'rt.Width = "Auto" '表格宽度为自动,也就是等于各列设置宽度之和
rt.Style.Font = tb.Font
tb.CreateReportHeader(rt,True) '生成表头,排除隐藏列
For c As Integer = 0 To tb.Cols.Count -1 '逐列设置和填入内容
    If tb.Cols(c).Visible Then
        rt.Cols(cnt).Width = tb.Cols(c).PrintWidth '列宽等于实际列宽
        If tb.Cols(c).IsNumeric OrElse tb.Cols(c).IsDate Then '如果是数值或日期列
            rt.Cols(cnt).Style.TextAlignHorz = prt.AlignHorzEnum.Right '数据水平靠右
        End If
        For r As Integer = 0 To tb.Rows.Count -1 '开始填入该列内容
            rt.Cells(r + hd, cnt).Text = tb(r,c)
        Next
        cnt = cnt + 1
    End If
Next
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray) '灰色网格线
rt.CellStyle.Spacing.All = 0.5 '单元格内距设为0.5毫米
rt.RowGroups(0, tb.HeaderRows).Header = prt.TableHeaderEnum.All '利用行组功能设置表头
doc.Body.Children.Add(rt) '将表格加入到报表
老师,您好,请问这个代码如果我这个表只需显示第一条记录,这个怎么加代码怎么改?
2楼
cjl333333333 发表于:2023/11/23 13:11:00
其实我就想把每个记录分开一个表,第一个表显示第一条记录,然后再做下个表显示下一条记录
3楼
有点蓝 发表于:2023/11/23 13:41:00

dim rr as row = tb.Rows(0)
For c As Integer = 0 To tb.Cols.Count -1 '逐列设置和填入内容
    If tb.Cols(c).Visible Then
        rt.Cols(cnt).Width = tb.Cols(c).PrintWidth '列宽等于实际列宽
        If tb.Cols(c).IsNumeric OrElse tb.Cols(c).IsDate Then '如果是数值或日期列
            rt.Cols(cnt).Style.TextAlignHorz = prt.AlignHorzEnum.Right '数据水平靠右
        End If
        rt.Cells(0, cnt).Text = rr(c)
        cnt = cnt + 1
    End If
Next
4楼
cjl333333333 发表于:2023/11/23 15:39:00
谢谢解决了。
共4 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .03302 s, 2 queries.