SchedulerPrintAdapter.SetSourceObject(Object) Method
Specifies the object used to get the scheduling data - the SchedulerStorage or the SchedulerControl object.
Namespace: DevExpress.XtraScheduler.Reporting
Assembly: DevExpress.XtraScheduler.v24.1.Core.Desktop.dll
NuGet Package: DevExpress.Scheduler.CoreDesktop
Declaration
Parameters
Name | Type | Description |
---|---|---|
sourceObject | Object | A SchedulerStorage or the SchedulerControl object. |
Remarks
This method is used to specify the correct scheduling source for the SchedulerPrintAdapter, despite the likely ambiguity caused by the fact that both the SchedulerStorage and the SchedulerControl can play the role of scheduling source.
The SetSourceObject method is abstract, and is overridden in the SchedulerPrintAdapter descendants.
It is intended for use when the report layout is loaded from the .repx file or a stream, and the type of the print adapter contained in the loaded layout is unknown. The following code snippet illustrates this situation.
using DevExpress.XtraScheduler.Reporting;
using DevExpress.XtraScheduler;
// ...
string reportFileName = "DailyStyle.repx";
// Creates a scheduler adapter for the Scheduler Control on the form
SchedulerControlPrintAdapter PrintAdapter =
new SchedulerControlPrintAdapter(this.schedulerControl1);
// Customize the print adapter...
// ...
// Create a new report
XtraSchedulerReport report = new XtraSchedulerReport();
// Loads the .repx file (only layout, no data)
report.LoadLayout(reportFileName);
// Specifies the correct scheduling source even if the type of the scheduler adapter
// in the loaded report is unknown
if(report.SchedulerAdapter != null)
report.SchedulerAdapter.SetSourceObject(PrintAdapter.SchedulerControl);
else
report.SchedulerAdapter = PrintAdapter;
// Invokes the Report Designer
report.ShowDesigner();