Foxtable(狐表)用户栏目专家坐堂 → 专业报表问题请教老师


  共有9570人关注过本帖平板打印复制链接

主题:专业报表问题请教老师

帅哥哟,离线,有人找我吗?
mamuaiqing
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:824 积分:6288 威望:0 精华:0 注册:2012/3/1 3:17:00
专业报表问题请教老师  发帖心情 Post By:2013/2/1 18:10:00 [只看该作者]

上图上项目,如图所示金额,金额2,金额3,金额4,金额位置是固定的,想实现金额2,3,4三列中不管哪列有没有数据存在都按金额的上一行开始向上排列,除非三列内容都为空,请教老师

 

 

 

Dim doc As New PrintDoc '定义一个报表
Dim rt As New prt.RenderTable() '定义一个表格对象
Dim rx As New prt.RenderText '定义一个文本对象

Doc.PageSetting.TopMargin = 2 '设置上边距
Doc.PageSetting.BottomMargin = 0 '设置下边距
Doc.PageSetting.RightMargin = 1 '设置右边距
Doc.PageSetting.LeftMargin = 0 '设置左边距

rt = New prt.RenderTable '创建表格对象
rt.x = 0
rt.y = 32
rt.Style.Font = New Font("宋体", 11 ) '设置字体
rt.Rows(0).Style.Font = New Font("宋体", 10 ) '惟独第一行字体大小为10
rt.Rows(1).Style.Font = New Font("宋体", 10 ) '惟独第一行字体大小为10
rt.Style.GridLines.All = New prt.Linedef '设置网格线
rt.Style.Padding.Left = 0 '左边距5毫米
rt.Rows.Count = 10 '设置总行数
rt.Cols.Count = 14 '设置总列数
rt.Height = 88 '设置表格的高度为80毫米
rt.Width = 198 '设置表格的宽度为198
rt.Rows(0).Height = 6 '设置第1行的高度为6毫米,剩余高度被平均分排到其他行
rt.Rows(1).Height = 6 '设置第2行的高度为6毫米,剩余高度被平均分排到其他行
rt.Rows(9).Height = 12 '设置第2行的高度为6毫米,剩余高度被平均分排到其他行
rt.Cols(0).Width = 30
rt.Cols(1).Width = 20
rt.Cols(2).Width = 20
rt.Cols(3).Width = 10
rt.Cols(4).Width = 20
rt.Cols(5).Width = 4
rt.Cols(6).Width = 4
rt.Cols(7).Width = 4
rt.Cols(8).Width = 4
rt.Cols(9).Width = 4
rt.Cols(10).Width = 4
rt.Cols(11).Width = 12
rt.Cols(12).Width = 20
rt.Cells(0,0).SpanRows = 2 '第1行第1个单元格向下合并2行
rt.Cells(0,1).SpanRows = 2 '第1行第2个单元格向下合并2行
rt.Cells(0,2).SpanRows = 2 '第1行第3个单元格向下合并2行
rt.Cells(0,3).SpanRows = 2 '第1行第4个单元格向下合并2行
rt.Cells(0,4).SpanRows = 2 '第1行第5个单元格向下合并2行
rt.Cells(0,11).SpanRows = 2 '第1行第12个单元格向下合并2行
rt.Cells(0,12).SpanRows = 2 '第1行第13个单元格向下合并2行
rt.Cells(0,13).SpanRows = 2 '第1行第13个单元格向下合并2行
rt.Cells(2,13).SpanRows = 3 '第3行第13个单元格向下合并2行
rt.Cells(5,13).SpanRows = 4 '第6行第13个单元格向下合并2行
rt.Cells(0,5).SpanCols = 6 '第1行第6个单元格向右合并6列
rt.Cells(9,1).SpanCols = 12 '第7行第1个单元格向右合并5列
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '内容垂直居中
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中排列
rt.Style.FontBold = True '字体加粗
rt.Cells(0,5).Text = "金    额"
rt.Cells(1,6).Text = "万"
rt.Cells(1,7).Text = "千"
rt.Cells(1,8).Text = "百"
rt.Cells(1,9).Text = "十"
rt.Cells(1,10).Text = "元"
Dim CurRow As Row = Tables("表A").Current
If CurRow.IsNull("金额")  Then
    CurRow("金额") = Nothing
Else
    rt.Cells(6,4).Text= "金额"
    Dim money2 As String = Tables("表A").Current("金额")
    rt.Cells(6, 11 - money2.length).Text = GetDigit(CInt(money2), money2.Length) '等于"¥"
    For i As Integer = 11 To 12 - money2.Length Step -1
        rt.Cells(6, i).Text = GetDigit(CInt(money2), 11-i)
    Next
End If

If CurRow.IsNull("金额2")  Then
    CurRow("金额2") = Nothing
Else
    rt.Cells(5,4).Text= "金额2"
    Dim money2 As String = Tables("表A").Current("金额2")
    rt.Cells(5, 11 - money2.length).Text = GetDigit(CInt(money2), money2.Length) '等于"¥"
    For i As Integer = 11 To 12 - money2.Length Step -1
        rt.Cells(5, i).Text = GetDigit(CInt(money2), 11-i)
    Next
End If

If CurRow.IsNull("金额3")  Then
    CurRow("金额3") = Nothing
Else
    rt.Cells(4,4).Text= "金额3"
    Dim money2 As String = Tables("表A").Current("金额3")
    rt.Cells(4, 11 - money2.length).Text = GetDigit(CInt(money2), money2.Length) '等于"¥"
    For i As Integer = 11 To 12 - money2.Length Step -1
        rt.Cells(4, i).Text = GetDigit(CInt(money2), 11-i)
    Next
End If

If CurRow.IsNull("金额4")  Then
    CurRow("金额4") = Nothing
Else
    rt.Cells(3,4).Text= "金额4"
    Dim money2 As String = Tables("表A").Current("金额4")
    rt.Cells(3, 11 - money2.length).Text = GetDigit(CInt(money2), money2.Length) '等于"¥"
    For i As Integer = 11 To 12 - money2.Length Step -1
        rt.Cells(3, i).Text = GetDigit(CInt(money2), 11-i)
    Next
End If

doc.Body.Children.Add(rt)
doc.AutoRotate = False '禁止自动旋转打印内容
doc.PageSetting.Landscape = True '横向打印
Doc.Preview() '预览报表

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目9.zip


图片点击可在新窗口打开查看此主题相关图片如下:图1.png
图片点击可在新窗口打开查看

 回到顶部
总数 24 1 2 3 下一页