如何在stimulsoft中设置文本格式

时间:2016-04-09 20:12:12

标签: c# stimulsoft

我使用此代码将数字传递给stimulsoft报告:

 stiReport1.Load(Application.StartupPath + "\\MyReport.mrt");
 (stiReport1.GetComponentByName("Text35") as StiText).Text = Mynumber.ToString();
 stiReport1.RegData(databaseDataSet.Mytable);
 stiReport1.Show();

我在MyReport中将Text35格式设置为与此图片相同: https://i.imgsafe.org/0a7bb2d.png

但它不起作用,例如显示12000而不是12,000

2 个答案:

答案 0 :(得分:1)

文本格式无所谓。这个数字在你的代码中转换为字符串:

= Mynumber.ToString();

如果需要更改格式,则应在ToString()方法中进行更改。

另一种方法是使用数字报表变量,在Text35文本组件中使用它并使用下一个代码设置其值:

report.Dictionary.Variables["Variable1"].Value = yourNumber;

答案 1 :(得分:0)

您可以在c#中处理它并传递格式化的字符串以报告:

Mynumber.ToString("##,###")
相关问题