电报报告没有显示波斯语的数字

本文关键字:波斯语 数字 显示 报告 | 更新日期: 2023-09-27 17:50:30

我在我的应用程序中使用teleerik报告,我设置文化'fa-IR'。在我的数据源中,当属性是十进制时,它以波斯语模式显示数字,但如果属性是字符串,它以英语显示数字我不能改变属性类型因为它有另一个字符

我想在波斯语模式的所有数字字符我能做什么?

电报报告没有显示波斯语的数字

如果您的属性是string,您只需要使用一个简单的方法将数字替换为等效的波斯数字。下面是一个可以使用的简单的扩展方法。

public string ToPersianNumber(this string s)
{
    Dictionary<string, string> dictionary = new Dictionary<string, string>();
    dictionary.Add("0", "٠");
    dictionary.Add("1", "١");
    dictionary.Add("2", "٢");
    dictionary.Add("3", "٣");
    dictionary.Add("4", "٤");
    dictionary.Add("5", "٥");
    dictionary.Add("6", "٦");
    dictionary.Add("7", "٧");
    dictionary.Add("8", "٨");
    dictionary.Add("9", "٩");
    dictionary.Aggregate(s, (current, value) => current.Replace(value.Key, value.Value)).ToString();
}

然后在你的属性上使用。

yourObject.yourProperty.ToPersianNumber();