ComponentOne GanttView for WPF
Saving Content in XML
Features > Task Management > Saving Content in XML

GanttView allows users to save the contents along with the layout into an XML file. This feature is available to users at runtime through the Save button available on the toolbar. Clicking the Save button opens the Save As XML dialog that lets you save the contents into an XML file.

Saving Content into XML in Code

The functionality to save content into an XML file can also be achieved programmatically through the SaveXml method of the C1GanttView class. The SaveXml method provides three overloads for saving the contents as listed below.

Overloads Description
SaveXml (String) To save the contents into an XML file.
SaveXml (Stream) To save the contents into an IO stream object.
SaveXml (StreamWriter) To save the contents into an XmlWriter object.

The following code illustrates how the SaveXml method can be used to save the contents into an XML file.

Dim dlg As New OpenFileDialog()
dlg.DefaultExt = ".xml"
dlg.FileName = "gantt"
dlg.Filter = "XML files|*.xml|All files|*.*"
dlg.Title = "Save Gantt View As Xml File"
If dlg.ShowDialog().Value Then
        gv.SaveXml(dlg.FileName)
End If
OpenFileDialog dlg = new OpenFileDialog();
dlg.DefaultExt = ".xml";
dlg.FileName = "gantt";
dlg.Filter = "XML files|*.xml|All files|*.*";
dlg.Title = "Save Gantt View As Xml File";
if (dlg.ShowDialog().Value)
 {
       gv.SaveXml(dlg.FileName);
 }
See Also