Features > Task Management > Loading Content from XML |
GanttView allows users to load the contents along with the layout from an XML file. This feature is available to users at runtime through the Load button available on the toolbar. Clicking the Load button opens the Load from XML file dialog that lets you load the XML file. In addition, GanttView provides ImportFromMsProjectXml method to load project schedules from Microsoft Project.
The functionality to load content from an XML file can also be achieved programmatically through the LoadXml method of the C1GanttView class. The LoadXml method provides three overloads for loading the contents as listed below.
Overloads | Description |
LoadXml (String) | To load the contents from an XML file. |
LoadXml (Stream) | To save the contents from an IO stream object. |
LoadXml (StreamWriter) | To save the contents from an XmlWriter object. |
The following code illustrates how the LoadXml method can be used to load the contents from an XML file.
Dim dlg As New OpenFileDialog()
dlg.DefaultExt = ".xml"
dlg.Filter = "XML files|*.xml|All files|*.*"
dlg.Title = "Load Gantt View From Xml File"
If dlg.ShowDialog().Value Then
gv.LoadXml(dlg.FileName)
Else
MessageBox.Show("Bad C1GanttView XML.", dlg.Title)
End If
OpenFileDialog dlg = new OpenFileDialog();
dlg.DefaultExt = ".xml";
dlg.Filter = "XML files|*.xml|All files|*.*";
dlg.Title = "Load Gantt View From Xml File";
if (dlg.ShowDialog().Value)
{
gv.LoadXml(dlg.FileName);
}
else
{
MessageBox.Show("Bad C1GanttView XML.", dlg.Title);
}