Rss & SiteMap

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

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

标题:专业报表合计问题

1楼
lin98 发表于:2024/6/23 9:18:00
 专业报表合计问题
rt.Cells(cnt, 6).Text = Format(sum3, "#,###.00") '
执行后,空值时,显示0,不好看,如何处理?

2楼
有点蓝 发表于:2024/6/23 20:43:00
判断一下是否空值,参考这里的方法:http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=192397&authorid=0&page=0&star=2
3楼
lin98 发表于:2024/6/24 9:01:00
        Dim sum2 As Double = 0

        For r As Integer = p * prs To math.min(Rows.Count - 1, ( p + 1) * prs - 1)
            sum2 += rows(r)("数量") '计算合计-数量

            For j As Integer = 0 To cols.Length - 1
                If Rows(r).IsNull(cols(j)) = False Then 
                    rt2.Cells(r - p * prs + 1, j).Text = rows(r)(cols(j))
                End If
            Next
        Next
rt2.Cells(cnt, 3).Text = Format(sum2, "#,###.00")

执行后,数量的合计为空值,还是显示0,如何实现为0不显示?

4楼
有点蓝 发表于:2024/6/24 9:06:00
没看到有对合计做判断
5楼
lin98 发表于:2024/6/24 9:31:00
        Dim sum2 As Double = 0

        For r As Integer = p * prs To math.min(Rows.Count - 1, ( p + 1) * prs - 1)
          
     If rows(r).isnull("数量") = False Then
            sum3 += rows(r)("数量") '
        End If
            For j As Integer = 0 To cols.Length - 1
                If Rows(r).IsNull(cols(j)) = False Then 
                    rt2.Cells(r - p * prs + 1, j).Text = rows(r)(cols(j))
                End If
            Next
        Next
rt2.Cells(cnt, 3).Text = Format(sum2, "#,###.00")

没报错,失效
   
6楼
有点蓝 发表于:2024/6/24 9:35:00
神仙思路!!

if sum2 <> 0
rt2.Cells(cnt, 3).Text = Format(sum2, "#,###.00")
end if
7楼
lin98 发表于:2024/6/24 11:05:00
       由于

 For p As Integer = 0 To math.Ceiling(Rows.Count / prs) - 1 '换页
        If p = math.Ceiling(Rows.Count / prs) - 1 Then'如果是最后一页
            For r As Integer = Rows.Count To ( p + 1) * prs - 1 '补空行
                rt2.Rows.Count = rt2.Rows.Count + 1
                rt2.Rows(rt2.Rows.count - 1)(0).text = " "
            Next
        Else
            rt.BreakAfter = prt.BreakEnum.Page '否则换页  
        End If
 Next
换页效果不理想,增加下面代码,效果好些,但就是最后会显示空白页,如何不显示最后的空白页?

 Dim rm5 As prt.RenderEmpty '定一个空对象
        rm5 = New prt.RenderEmpty '定义一个新的空对象
        rm5.BreakBefore = prt.BreakEnum.Page '打印前换页
        doc.Body.Children.Add(rm5) '加入到报表中
8楼
有点蓝 发表于:2024/6/24 11:37:00
换页放到前面,先换页再打印
共8 条记录, 每页显示 10 条, 页签: [1]

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

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