您好,
区域报表的创建和RDL报表略有区别。代码可以参考:
- protected void Page_Load(object sender, EventArgs e)
- {
- GrapeCity.ActiveReports.SectionReport sr = new GrapeCity.ActiveReports.SectionReport();
- System.Xml.XmlTextReader xtr = new System.Xml.XmlTextReader(Server.MapPath("") + "\\SectionReport1.rpx");
- sr.LoadLayout(xtr);
- xtr.Close();
- sr.DataSource = GetDataSource();
- sr.Run();
- WebViewer1.Report = sr;
- }
- private DataTable GetDataSource()
- {
- DataTable dt = new DataTable();
- dt.Columns.Add("产品编号");
- dt.Columns.Add("产品名称");
- dt.Columns.Add("单价");
- dt.Columns.Add("库存量");
- dt.Rows.Add("A10002", "苹果", 20, 50);
- dt.Rows.Add("A15681", "香蕉", 20, 50);
- dt.Rows.Add("A15681", "菠萝", 20, 50);
- return dt;
- }
复制代码
希望能够帮助到您。 |