
The Scheduler image export can be used outside of ASP.NET web pages.
You need to create the control and set all the necessary properties in the code.
This is a minimal example that saves the image to a file (default colors and fonts):
DayPilotScheduler s = new DayPilotScheduler();
s.DataStartField = "start";
s.DataEndField = "end";
s.DataResourceField = "resource";
s.DataTextField = "name";
s.DataValueField = "id";
s.DataSource = getBackgroundData();
s.Resources.Add("Resource A", "A");
s.StartDate = DateTime.Today;
s.Days = 1;
s.DataBind();
MemoryStream ms = s.Export(ImageFormat.Png);
using (FileStream fs = new FileStream("c:/var/log/aspnet/output.png", FileMode.CreateNew))
{
ms.WriteTo(fs);
}
ms.Close();Testing data generator:
private DataTable getBackgroundData()
{
DataTable dt;
dt = new DataTable();
dt.Columns.Add("start", typeof(DateTime));
dt.Columns.Add("end", typeof(DateTime));
dt.Columns.Add("name", typeof(string));
dt.Columns.Add("id", typeof(string));
dt.Columns.Add("resource", typeof(string));
DataRow dr;
dr = dt.NewRow();
dr["id"] = 1;
dr["start"] = Convert.ToDateTime("15:00");
dr["end"] = Convert.ToDateTime("16:00").AddDays(2);
dr["name"] = "First";
dr["resource"] = "A";
dt.Rows.Add(dr);
return dt;
}