# Export

## Content



GanttView provides various methods to export its content in the desired formats such as XML and MS projects.

Let us discuss how to export GanttView and its content to various formats.

### Export to XML

To serialize grid contents into an XML document, you can simply use [SaveXml](/componentone/api/wpf/online-ganttview/dotnet-api/C1.WPF.GanttView/C1.WPF.GanttView.C1GanttView.SaveXml.html) method of the <span data-popup-content="This class is available in \u003ca href=\u0022/componentone/api/wpf/online-ganttview/dotnet-api/C1.WPF.GanttView/C1.WPF.GanttView.C1GanttView.html\u0022\u003e.NET\u003c/a\u003e and \u003ca href=\u0022/componentone/api/wpf/online-ganttview/dotnet-api/C1.WPF.GanttView/C1.WPF.GanttView.C1GanttView.html\u0022\u003e.NET Framework\u003c/a\u003e." data-popup-title="C1GanttView" data-popup-theme="ui-tooltip-green qtip-green">C1GanttView</span> class. The **SaveXml** method provides various overloads for saving the contents as listed below.

| Overload | Description |
| --- | --- |
| SaveXml(string fileName) | To save the contents into an XML file. |
| SaveXml(string fileName, System.Text.Encoding encoding) | Saves the contents into an XML file with encoding. |
| SaveXml(System.IO.Stream stream) | Saves the contents into an IO stream object. |
| SaveXml(System.IO.Stream stream, System.Text.Encoding encoding) | Saves the contents into an IO stream object with encoding. |
| SaveXml(System.Xml.XmlWriter writer) | Saves 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. This code exports all the project schedules to an XML file named gantt.

```csharp
SaveFileDialog dlg = new SaveFileDialog();
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);
}
```

### Export to MS Project

The GanttView control supports exporting GanttView schedules to MS Project using [ExportToMsProjectXml](/componentone/api/wpf/online-ganttview/dotnet-api/C1.WPF.GanttView/C1.WPF.GanttView.C1GanttView.ExportToMsProjectXml.html) method of the **C1GanttView** class.

Use the following code to save GanttView schedules to MS project.

```csharp
SaveFileDialog dlg = new SaveFileDialog();
dlg.DefaultExt = ".xml";
dlg.FileName = "ganttMSProject";
dlg.Filter = "XML files|*.xml|All files|*.*";
dlg.Title = "Save Gantt View As MsProject Xml File";
gv.ExportToMsProjectXml();
```