diff --git a/ej2-asp-core-mvc/code-snippet/gantt/how-to/xmlToData/razor b/ej2-asp-core-mvc/code-snippet/gantt/how-to/xmlToData/razor new file mode 100644 index 0000000000..2a83cf801b --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/gantt/how-to/xmlToData/razor @@ -0,0 +1,79 @@ +@Html.EJS().Uploader("UploadFiles").AutoUpload(false).Selected("onSelect").AllowedExtensions(".xml").Render() + +@Html.EJS().Gantt("Gantt").DataSource((IEnumerable)ViewBag.dataSource).Height("450px").TaskFields(ts => + ts.Id("TaskId").Name("TaskName").StartDate("StartDate").EndDate("EndDate").Duration("Duration").Progress("Progress").ParentID("ParentId") + ).Columns(col => + { + col.Field("TaskId").HeaderText("Task ID").Add(); + col.Field("TaskName").HeaderText("Task Name").Width(250).Add(); + col.Field("StartDate").HeaderText("Start Date").Add(); + col.Field("Duration").HeaderText("Duration").Add(); + col.Field("Progress").HeaderText("Progress").Format("C").Add(); + }).Render() + + \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/gantt/how-to/xmlToData/tagHelper b/ej2-asp-core-mvc/code-snippet/gantt/how-to/xmlToData/tagHelper new file mode 100644 index 0000000000..44e1c283ce --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/gantt/how-to/xmlToData/tagHelper @@ -0,0 +1,73 @@ + + + + + + + + \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/gantt/how-to/xmlToData/xmlToData.cs b/ej2-asp-core-mvc/code-snippet/gantt/how-to/xmlToData/xmlToData.cs new file mode 100644 index 0000000000..eec9005cde --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/gantt/how-to/xmlToData/xmlToData.cs @@ -0,0 +1,5 @@ +public IActionResult Index() +{ + ViewBag.DataSource = GanttData.ProjectNewData(); + return View(); +} \ No newline at end of file diff --git a/ej2-asp-core-mvc/gantt/how-to/xml-to-data.md b/ej2-asp-core-mvc/gantt/how-to/xml-to-data.md new file mode 100644 index 0000000000..f7b4654780 --- /dev/null +++ b/ej2-asp-core-mvc/gantt/how-to/xml-to-data.md @@ -0,0 +1,49 @@ +--- +layout: post +title: Import Microsoft Project XML into ##Platform_Name## Gantt Component| Syncfusion +description: Learn here to import microsoft project XML into Syncfusion ##Platform_Name## Gantt component of Syncfusion Essential JS 2 and more. +platform: ej2-asp-core-mvc +control: Xml to data +publishingplatform: ##Platform_Name## +documentation: ug +--- + +# Import Microsoft Project XML into Gantt Chart + +In this guide, we'll explore how to import task data from an XML file into a Gantt Chart. This example assumes you have an XML file conforming to the Microsoft Project XML schema, containing task-related information. + +## Steps + +* Add a file upload component to your application using Syncfusion's `Uploader` component. This allows users to upload XML files easily. +* Implement the `Selected` method in the Uploader. This method reads the uploaded XML file, converts it into a list of GanttDataSource objects, and updates the Gantt Chart's data source. +* Use the xmlToJson method to parse the XML content and convert it into JSON format. +* Implement additional utility methods, such as `transformGanttData`, to handle specific data transformations required for the Gantt Chart. +* Ensure that your Gantt Chart component is initialized with the appropriate task fields and edit settings. + +With these steps, you'll be able to seamlessly import task data from XML files and display it in the Gantt Chart. + +The following code snippet demonstrates how to import a Microsoft Project XML file into the Gantt Chart control. + +{% if page.publishingplatform == "aspnet-core" %} + +{% tabs %} +{% highlight cshtml tabtitle="CSHTML" %} +{% include code-snippet/gantt/how-to/xmlToData/tagHelper %} +{% endhighlight %} +{% highlight c# tabtitle="xmlToData.cs" %} +{% include code-snippet/gantt/how-to/xmlToData/xmlToData.cs %} +{% endhighlight %} +{% endtabs %} + +{% elsif page.publishingplatform == "aspnet-mvc" %} + +{% tabs %} +{% highlight razor tabtitle="CSHTML" %} +{% include code-snippet/gantt/how-to/xmlToData/razor %} +{% endhighlight %} +{% highlight c# tabtitle="xmlToData.cs" %} +{% include code-snippet/gantt/how-to/xmlToData/xmlToData.cs %} +{% endhighlight %} +{% endtabs %} +{% endif %} + diff --git a/ej2-asp-core-toc.html b/ej2-asp-core-toc.html index 8b7453844b..8479975d10 100644 --- a/ej2-asp-core-toc.html +++ b/ej2-asp-core-toc.html @@ -1284,6 +1284,7 @@
  • Drag and drop from another component
  • Add new row position while adding
  • Restrict collapsing of records when clicking on Gantt chart rows
  • +
  • Import microsoft project XML into Gantt chart
  • diff --git a/ej2-asp-mvc-toc.html b/ej2-asp-mvc-toc.html index bce0cc241a..9d4b470d5a 100644 --- a/ej2-asp-mvc-toc.html +++ b/ej2-asp-mvc-toc.html @@ -1232,6 +1232,7 @@
  • Drag and drop from another component
  • Add new row position while adding
  • Restrict collapsing of records when clicking on Gantt chart rows
  • +
  • Import microsoft project XML into Gantt chart