我正在使用Rdlc报告。
我有这些领域:
First name
Address1
Address2
City, state, zip
如果这些字段中的任何一个为空,则不应显示空格。
例如(预期输出)
First name,
Address1,
City, state, zip
但是,如上图所示,我得到了:
First name,
Address1,
........................<-(blankspace is showing here)
City, state, zip
我尝试更改
Visiblity
-> Expression
->=IIF(String.IsNullOrEmpty(Fields!Address2.Value), false,True)
最佳答案
我认为使用String.IsNullOrEmpty
的表达式不起作用。
尝试使用以下两个选项之一:
1. =IIF(IsNothing(Fields!Address2.Value),False,True)
2. =IIF(Len(Fields!Address2.Value) = 0,False,True)
根据评论,解决方案是创建一个文本框,在其中放置两个(或多个)字段,并在第二个字段具有实际值或为空的情况下将值连接起来。
因此表达式将是:
=Fields!Name.Value + System.Environment.NewLine + Fields!SAddr_Line1.Value + IIF(Len(Fields!Address2.Value) = 0, "", System.Environment.NewLine + Fields!Address2.Value) + Fields!ShipTo.Value
为了提高可读性:
=Fields!Name.Value
+ System.Environment.NewLine
+ Fields!SAddr_Line1.Value
+ IIF(Len(Fields!Address2.Value) = 0, "", System.Environment.NewLine + Fields!Address2.Value)
+ Fields!ShipTo.Value
关于提交时的Rdlc报告对齐为空或为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13817350/