The sample shows how to use the
SavingReport
and
LoadingReport
events in the code. You can add the event listener to the
StiDesigner
class at application initialization:
static Form1()
{
StiDesigner.SavingReport += new StiSavingObjectEventHandler(OnSaving);
StiDesigner.LoadingReport += new StiLoadingObjectEventHandler(OnLoading);
// If you need you can hide menu item "Save As.."
StiMainMenuService service = StiMainMenuService.GetService();
service.ShowFileReportSaveAs = false;
}
Specify the action to be performed when the report will be saved:
private static void OnSaving(object sender, StiSavingObjectEventArgs e)
{
StiDesigner designer = sender as StiDesigner;
//string str = designer.Report.SaveToString();
MessageBox.Show("Report saved");
}
Specify the action to be performed when the report will be loaded:
private static void OnLoading(object sender, StiLoadingObjectEventArgs e)
{
StiDesigner designer = sender as StiDesigner;
//designer.Report.LoadFromString(str);
MessageBox.Show("Report loaded");
}
Auf dem Screenshot unten Sie können das Ergebnis des Beispiel-Codes ansehen: