我保存报告模板:
report.Save("C:\\kk.mrt");
然后我加载保存的报告并将其分配BusinessObjects
为Dictionaries
StiReport rptLoad = new StiReport();
rptLoad.RegBusinessObject("Company", repository.GetAll<Company>());
rptLoad.Load("C:\\kk.mrt");
rptLoad.BusinessObjectsStore
包含已注册的BusinessObjects
刚刚注册 ( Watched
at RunTime
) 但是:
rptLoad.Show();
如果保存的报告中包含
Bindings
(如:):那么Components.Add(new StiText{Text="{Company.Name}"}
得到我:
error CS0103: The name 'Company' does not exist in the current context
否则,如果我没有
Bindings
保存的报告:那么rptLoad.Show();
将显示报告,但没有注册Dictionaries
(当我在显示报告后进入设计模式时,我BusinessObjects
在字典中没有看到)。如果我
rptLoad.Design();
之前打电话rptLoad.Show();
:那么
报告显示并且Bindings
正常,我可以BusinessObjects
在显示的报告中看到(在设计和预览模式下)。