我保存报告模板:
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 contextBindings,则
rptLoad.Show();将显示报告,但是没有注册的Dictionaries (当我显示报告后进入设计模式时,我在字典中没有看到BusinessObjects )。rptLoad.Design();之前调用rptLoad.Show();:那么报告显示和Bindings都正常,我可以在显示的报告中看到BusinessObjects (在设计和预览模式下)。
发布于 2013-03-16 08:31:40
找出原因:
rptLoad.Dictionary.Synchronize();应该在rptLoad.RegBusinessObject("Company", repository.GetAll<Company>());之后调用
https://stackoverflow.com/questions/15447108
复制相似问题