如何格式化不带逗号的整数数据源,然后在 crystal 报告中的列前后放置星号?
How to format integer data source without comma then put star before and after the column in crystal reports?
我有订单 ID 列,我需要在整数值前后加上星号,但首先我需要删除 crystal 报告中的逗号:
1-插入文本框并写入**
2- 从 table
中插入订单 ID 列
3- 格式化对象并保持无逗号 (1122) 格式
4- 当我需要在 ** 之间拖放订单 ID 字段时,它不接受。
5- 如何在整数之前和 * 之后插入 * 并在之后格式化数字。
6-默认订单id值像这个例子:
2,000,000,180
我需要删除逗号并保持原样
2000000180
然后在前后加星*2000000180*
并始终从数据库中读取订单 ID 值。
注意:
我可以将整数订单 ID 列直接从字段资源管理器拖放到星号之间的文本框,但是如果我将列放在工作区部分,我就不能将它放在 atar 之间。
如何解决此问题并在格式化对象后添加星标?
您可以使用 string.Rplace() 方法删除 ',' 而不是 string.format 添加 *.
string orderId = "111,222,333,444";
string cleanId = string.Replace(",","");
string text = string.Format("*{0}*", cleanId);
注意,如果您使用的是 c# 8 及更高版本,则可以使用字符串插值代替 string.Format。
string text = $"*{cleanId}*";
1- 在 crystal 报告中右键单击公式字段然后 select 新建 .
2- 输入公式的名称。
3- 在 crystal 语法下键入以下代码:
stringvar replaceid := Replace("2,000,000,180",",","");
stringvar Result := "*" + replaceid + "*"
4- 替换命令,此语法将删除逗号。
5- 结果将是 *2000000180*
我有订单 ID 列,我需要在整数值前后加上星号,但首先我需要删除 crystal 报告中的逗号:
1-插入文本框并写入**
2- 从 table
中插入订单 ID 列3- 格式化对象并保持无逗号 (1122) 格式
4- 当我需要在 ** 之间拖放订单 ID 字段时,它不接受。
5- 如何在整数之前和 * 之后插入 * 并在之后格式化数字。
6-默认订单id值像这个例子:
2,000,000,180
我需要删除逗号并保持原样
2000000180
然后在前后加星*2000000180*
并始终从数据库中读取订单 ID 值。
注意:
我可以将整数订单 ID 列直接从字段资源管理器拖放到星号之间的文本框,但是如果我将列放在工作区部分,我就不能将它放在 atar 之间。
如何解决此问题并在格式化对象后添加星标?
您可以使用 string.Rplace() 方法删除 ',' 而不是 string.format 添加 *.
string orderId = "111,222,333,444";
string cleanId = string.Replace(",","");
string text = string.Format("*{0}*", cleanId);
注意,如果您使用的是 c# 8 及更高版本,则可以使用字符串插值代替 string.Format。
string text = $"*{cleanId}*";
1- 在 crystal 报告中右键单击公式字段然后 select 新建 .
2- 输入公式的名称。
3- 在 crystal 语法下键入以下代码:
stringvar replaceid := Replace("2,000,000,180",",","");
stringvar Result := "*" + replaceid + "*"
4- 替换命令,此语法将删除逗号。
5- 结果将是 *2000000180*