【Stimulsoft Reports Silverlight教程】在报表中使用Business Objects

此示例显示如何使用Business Objects集合创建报表。

下载Stimulsoft Reports Silverlight最新版本

此示例显示如何使用Business Objects集合创建报表。Business Objects是一个对象类数据,使用它可以以不同的结构呈现数据:表,列表,数组等。要使用Bisiness对象,您可以使用报表对象的RegBusinessObject()方法:

private void btDesign_Click(object sender, RoutedEventArgs e){    var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(        "UsingBusinessObjects.SimpleList.mrt");    StiReport report = new StiReport();    report.Load(stream);    stream.Close();    stream.Dispose();    stream = null;    report.CalculationMode = StiCalculationMode.Interpretation;    report.RegBusinessObject("Data", "Data", new Data());    report.Design();}private void btPreview_Click(object sender, RoutedEventArgs e){    var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(        "UsingBusinessObjects.SimpleList.mrt");    StiReport report = new StiReport();    report.Load(stream);    stream.Close();    stream.Dispose();    stream = null;    report.CalculationMode = StiCalculationMode.Interpretation;    report.RegBusinessObject("Data", "Data", new Data());    report.Render();    report.Show();}

Data()对象包含报表所需的数据结构和数据行:

public class Data{    private List<CategoriesItem> categoriesItems = new List<CategoriesItem>();    public List<CategoriesItem> Categories    {        get        {            return categoriesItems;        }        set        {            categoriesItems = value;        }    }    public class CategoriesItem    {        private List<ProductsItem> products;        public List<ProductsItem> Products        {            get            {                return products;            }            set            {                products = value;            }        }        private System.Int32categoryID;        public System.Int32CategoryID        {            get            {                return categoryID;            }            set            {                categoryID = value;            }        }...

下面的屏幕截图中,您可以看到示例代码的结果。

Stimulsoft

下载示例

购买Stimulsoft正版授权,请点击“咨询在线客服”哟!

GrapeCity年末福利大放送
标签:报表报表控件SilverlightStimulsoft

来源:慧都

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2018年11月7日
下一篇 2018年11月7日

相关推荐

发表回复

登录后才能评论