GanttView for WPF
エクスポート
エクスポートとインポート > エクスポート

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 method of the C1GanttView class. The SaveXml method provides various overloads for saving the contents as listed below.

オーバーロード 説明
SaveXml(string fileName) コンテンツを XML ファイルに保存します。
SaveXml(string fileName, System.Text.Encoding encoding) Saves the contents into an XML file with encoding.
SaveXml(System.IO.Stream stream) コンテンツを IO ストリームオブジェクトに保存します。
SaveXml(System.IO.Stream stream, System.Text.Encoding encoding) Saves the contents into an IO stream object with encoding.
SaveXml(System.Xml.XmlWriter writer) コンテンツを XmlWriter オブジェクトに保存します。

次のコードは、SaveXml メソッドを使用して、コンテンツを XML ファイルに保存する方法を示します。 This code exports all the project schedules to an XML file named gantt.

C#
コードのコピー
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 method of the C1GanttView class.

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

C#
コードのコピー
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();