Using Designer Events
Our sample projects and report templates can help you learn the basics of working with our products.The designer raises events for creating, saving and previewing a report. This example registers data on new reports and reacts to saves.
Designer setup. Configure the designer, load the report template, process its callbacks, and connect the save action to the application.
Designer setup. Configure the designer, load the report template, process its callbacks, and connect the save action to the application.
@Component({
selector: "using-designer-events",
imports: [Designer],
template: `<sti-designer [report]="report" [options]="designerOptions" (onCreateReport)="onCreateReport($event)" (onSaveReport)="onSaveReport($event)"></sti-designer>`
})
export class UsingDesignerEvents {
report = new Stimulsoft.Report.StiReport();
designerOptions = new Stimulsoft.Designer.StiDesignerOptions();
onCreateReport(args: Stimulsoft.Designer.CreateReportArgs) {
var dataSet = new Stimulsoft.System.Data.DataSet("Demo");
dataSet.readJsonFile("Data/Demo.json");
args.report.regData("Demo", "Demo", dataSet);
args.report.dictionary.synchronize();
}
onSaveReport(args: Stimulsoft.Designer.SaveReportArgs) { alert("onSaveReport event"); }
constructor() { this.report.loadFile("Reports/SimpleList.mrt"); }
}Each event receives the current report through args.report; onCreateReport pre-registers data for new reports, and onSaveReport is where you persist the edited template.