使用DevExpress.XtraReports.UI.XtraReport 设计报表的时候如何格式化字符串

 DataTable dt = new DataTable();
            dt = _dt;
            Report.DataSource = dt;

            XRBinding binding;
            binding = new XRBinding("Text", DataSource, "a.field1");
            xlable1.DataBindings.Add(binding);
            binding = new XRBinding("Text", DataSource, "a.field2");
            xlable2.DataBindings.Add(binding);
            binding = new XRBinding("Text", DataSource, "a.ym_pc");
            xlable3.DataBindings.Add(binding);
            binding = new XRBinding("Text", DataSource, "a.st_se");
            binding.FormatString = "{0:n2}";//把这个里面的数据格式化为  123,123,123。23这种格式
            xlable4.DataBindings.Add(binding);


            binding = new XRBinding("Text", DataSource, "a.xmType");
            xrTableCell5.DataBindings.Add(binding);
            binding = new XRBinding("Text", DataSource, "a.fenleiSE");
            binding.FormatString = "{0:n2}";
            xrTableCell7.DataBindings.Add(binding);

            GroupField groupField2 = new GroupField("xmType");
            GroupHeader2.GroupFields.Add(groupField2);


            binding = new XRBinding("Text", DataSource, "a.field");
            xlable5.DataBindings.Add(binding);
            binding = new XRBinding("Text", DataSource, "a.fieldSE");
            binding.FormatString = "{0:n2}";
            xlable6.DataBindings.Add(binding);

            GroupField groupField = new GroupField("field");
            GroupHeader1.GroupFields.Add(groupField);

 

posted @ 2013-01-22 14:18  下-个路口  阅读(4837)  评论(0编辑  收藏  举报