水晶报表进行页小计、固定行分页、分页中每页显示紧贴式页脚的方法

http://kongjian.baidu.com/xpj_jy/blog/item/168fcc5004b1e2828c543090.html
1.要进行页小计,需要在报表设计时建立3个公式,一个(SumRows)放在明细节内用于WhilePrintingRecords事件进行全局变量RowTotal累加,一个(PageTotal)放在页脚n(报脚n、组脚n、细节n)内用于反映RowTotal即时值,一个(Reset)放在PageTotal后用于下页前回零RowTotal;

SumRows公式:
WhilePrintingRecords
global RowTotal as currency
RowTotal= RowTotal + CCur({Order.Money})
formula=RowTotal

PageTotal公式:
WhilePrintingRecords
global RowTotal as currency
formula=RowTotal     
    
Reset公式:
EvaluateAfter ({@SumRows})
global RowTotal as currency
RowTotal=0
formula=0
    
2.固定行分页
要进行固定行分页需要在报表设计时添加参数PrintRows(设为数值型,默认值设10)用于打印前告诉报表打多少行,动态赋值代码:
Dim oFld As CRAXDRT.ParameterFieldDefinition
dim nRows as integer
nRows=8
For Each oFld In oReport.ParameterFields

If oFld.ParameterFieldName = "printrows" Then

oFld.AddCurrentValue nRows
Exit For
End If

Next
然后编辑明细节“在后面页新建页”公式内容加入:
if Remainder(RecordNumber, {?printrows}) = 0 then
if OnLastRecord then
formula=false
else
formula=true
end if
end if

3.最恼人的问题,分页中每页显示紧贴式页脚?只有组节和明细节可实现紧贴页脚!这里使用明细节替代页脚:
需要2个明细节,第一个用于正常显示明细记录,第二个用于代替页脚放置业脚内容,编辑第二明细节"抑制显示"公式,内容加入:
if Remainder(RecordNumber, {?printrows} ) <> 0 then
if OnLastRecord then
formula=false
else
formula=true
end if
end if  

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值