如何在RDLC报告中用新行替换空间 [英] How to replace space with new line in RDLC report

查看:158
本文介绍了如何在RDLC报告中用新行替换空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果插入地址如...



T2 Terminal International Airport,

MTNL Road,

Andheri,

Sakinaka,

孟买,

马哈拉施特拉邦





在Rdlc报告中显示如下

T2 Terminal International Airport,MTNL Road,Andheri,Sakinaka,Mumbai,Maharashtra。



请建议如何用新线替换空间......



我尝试过的事情:



 = First(Fields!address.Value,DataSet4)。ToString()。Replace(System.Environment.NewLine,)

< br $>


 =替换(First(Fields!address.Value,DataSet4),System.Environment.NewLine,)

解决方案

参见 System.String.Replace(String,String) [ ^ ]。第一个参数是旧值(要替换的字符串),第二个参数是要插入的字符串。你已经传递了这些互换的参数。



另请注意,您可能希望替换逗号(使用可选的尾随空格)。否则你也会从你的例子中拆分包含T2 Terminal International Airport等空格的字符串。



所以使用

替换( ,System.Environment.NewLine)


if Insert Address like...

T2 Terminal International Airport,
MTNL Road,
Andheri,
Sakinaka,
Mumbai,
Maharashtra


in Rdlc report show like this
T2 Terminal International Airport, MTNL Road, Andheri, Sakinaka, Mumbai,Maharashtra.

please Suggest how to replace space with new line...

What I have tried:

=First(Fields!address.Value, "DataSet4").ToString().Replace(System.Environment.NewLine," ")



=Replace(First(Fields!address.Value, "DataSet4"),System.Environment.NewLine," ")

解决方案

See System.String.Replace(String, String)[^]. The first parameter is the old value (the string to be replaced), and the second one is the string to be inserted. You have passed these parameters interchanged.

Note also that you probably want to replace the comma instead (with optional trailing space). Otherwise you would also split strings containing spaces like "T2 Terminal International Airport" from your example.

So use

Replace(", ", System.Environment.NewLine)


这篇关于如何在RDLC报告中用新行替换空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆