I save the report template :
report.Save("C:\\kk.mrt");
then I load the saved report and assign it BusinessObjects
as Dictionaries
StiReport rptLoad = new StiReport();
rptLoad.RegBusinessObject("Company", repository.GetAll<Company>());
rptLoad.Load("C:\\kk.mrt");
rptLoad.BusinessObjectsStore
contains registered BusinessObjects
just registered (Watched
at RunTime
) but :
rptLoad.Show();
IF there are Bindings
(Like: Components.Add(new StiText{Text="{Company.Name}"}
) included in the saved report : THEN
gets me : error CS0103: The name 'Company' does not exist in the current context
ELSE IF I have no Bindings
in saved report : THEN
rptLoad.Show();
will show the report , but with no registered Dictionaries
(As i go to design mode after showing the report I see no BusinessObjects
in Dictionary).
And IF I call rptLoad.Design();
before rptLoad.Show();
: THEN
the report shows and Bindings
are OK and I can see BusinessObjects
in the shown report (in both design and preview mode).
Found the cause :
rptLoad.Dictionary.Synchronize();
should call after rptLoad.RegBusinessObject("Company", repository.GetAll<Company>());