提交时的Rdlc报告对齐为空或为空

标签 rdlc

我正在使用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/

相关文章:

RDLC 分组行

RDLC:在不使用子报表的情况下显示子集合数据

visual-studio-2008 - Visual Studio 2010是否要求将在VS2008上创建的RDLC转换为RDLC 2008格式?

c# - 如何限制 rdlc 报告表中显示的行数?

reportviewer - 从Reportviewer转换为PDF时显示选中的复选框

reporting-services - 替换 Reporting Services RDLC 报告的数据源

c# - Visual Studio 2015 社区报告查看器版本 12 使用 C# 获取额外 margin 时出错

xml - 如何在动态创建的报告查看器的每个页面上显示标题

vb.net - rdlc CountDistinct 其中状态 = 1

reportviewer - 尝试计算 RDLC 中列中非零行的平均值