您的位置:首页 > 其它

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

2012-06-06 17:16 766 查看
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  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  报表 integer each c