RDLC 微软报表 自定义函数
报表的空白处点右键,报表属性,CODE,按下面的格式输入自定义函数:
Shared Function ShowDate(value as DateTime) as string
if value<=DateValue("1900-1-1") then
return ""
else
return FormatDateTime(value,DateFormat.ShortDate)
end if
End Function
调用: 表达式中输入
=code.ShowNumber(Fields!PurchCC.Value,3)
格式化数字:
Shared Function ShowNumber(value as Double, digit as integer ) as string
if value=0 then
return ""
else
return FormatNumber(value, digit)
end if
End Function