1

我可以知道是否可以将对象列表绑定到 stimulsoft 网络?我正在尝试将它与 regbusinessobject 绑定,但我没有机会获取预期的数据。设计器中始终存在空白业务对象

我的代码是:

StiReport report = new StiReport();
DBEntities entity = new DBEntities();
List<Section> result = entity.Sections.ToList();
report.RegBusinessObject("Section",result);
StiWebDesigner1.Report=report;
stiWebDesigner1.Desighn();
4

1 回答 1

2

在 Web 中,您可以先创建业务对象的描述,然后创建报表模板,然后将数据源与真实数据连接并呈现报表。创建业务对象的描述。注意!:您必须使业务对象的类与 .NET 中的业务对象类相同

DBEntities entity = new DBEntities();
List<Section> result = entity.Sections.ToList();

StiReport report = new StiReport();
report.RegBusinessObject("Section",result);

int busobjLevel = 1;
report.Dictionary.SynchronizeBusinessObjects(busobjLevel);

//in web you should call design with parameter like this
StiWebDesigner1.Design(report);

用于显示报告:创建报告模板后,您可以将其保存,例如保存到以下路径 D:\myReport.mrt。由于业务对象的描述不包含实际数据,为了构建报表,您应该获取业务对象的真实数据

int busobjLevel = 1; 

StiReport report = new StiReport();

report.Load("D:\\myReport.mrt"); 

using (DBEntitiescontext = new DBEntities())

{

var result = entity.Sections.ToList();

report.RegBusinessObject("Sections", result);

StiWebViewer1.Report = report;

}
于 2014-08-07T10:22:14.753 回答