<syncfusion:GanttControl x:Name="Gantt" ScheduleType="MinutesWithSeconds"
Loaded="GanttGrid_Loaded" >
…
</ syncfusion:GanttControl> |
Hi Gian Piero
Truccolo,
Query: How do you export to XML if the
observable collection is a type other than TaskDetails? I'm using my own
Task model. Is this possible?
Yes, we have achieved your requirement as per the below code snippet
Code
snippet:[MainWindow.cs]
private void ButtonBase_OnClick(object sender,
RoutedEventArgs e) {
Microsoft.Win32.SaveFileDialog saveFileDialog = new
Microsoft.Win32.SaveFileDialog();
saveFileDialog.Filter = "XML Files (*.XML)|*.xml";
saveFileDialog.FileName = "Untitled"; if
(saveFileDialog.ShowDialog() == true) {
if (!String.IsNullOrEmpty(saveFileDialog.FileName))
{
ExportToXML(Gantt.ItemsSource as IEnumerable,
saveFileDialog.FileName);
} } } public static void ExportToXML(IEnumerable
taskDetailsCollection, string FilePath) { //
Initializing the variables to create objects for exporting. Project
project = new Project();
Dictionary<Task, Syncfusion.ProjIO.Task> likendTasks = new
Dictionary<Task, Syncfusion.ProjIO.Task>();
Dictionary<Task, Syncfusion.ProjIO.Task> linearTasks = new
Dictionary<Task, Syncfusion.ProjIO.Task>();
List<Assignment> assignedTasks = new List<Assignment>(); // Creating
the poject tasks and getting the input for assignment and predecessor
project.RootTask.Children = CreateProjectTasks(taskDetailsCollection,
likendTasks, assignedTasks, linearTasks);
project.CalculateTaskIDs(); // Creating
predecessors if
(likendTasks.Count > 0)
UpdateLinkedTasks(likendTasks, linearTasks); // Creating
resource assignment if
(assignedTasks.Count > 0) {
project.Assignments.AddRange(assignedTasks);
project.Resources = assignedTasks.Select((a) =>
a.Resource).ToList(); } //
Calculating UIDs of tasks and resources
project.CalculateResourceIDs(); // Exporting
the current project to xml
project.Save(FilePath); } |
Please
have a sample from the below link
https://www.syncfusion.com/downloads/support/forum/160178/ze/ExportXML1146884535
Query
2 : With exporting to image how do you export the entire chart and grid?
We have analysed your requirement and we don't have a support to
export the grid as an image. We can export the grid in an excel format.
And we can export a chart as an image, we have prepared a sample
for your requirement. Please have a sample from the below link
https://www.syncfusion.com/downloads/support/forum/160178/ze/ExportasImage925122485
Let us know if you need any further assistance.
Regards,
Sridevi S.