Export Predeccessor and Successor fields from XER file to XLSX. How can I export all the fields

I want to Export fields from XER file. How can I do that? Can you provide a sample code for the same. For example, the predeccessor and Successor fields or Predecessor Details/ Successor Details.

@abhargava ,
if you want to export Predeccessor and Successor fields to XLSX format,
you can specify add GanttChartColumn with Field.TaskSuccessors.

Also you can add a custom GanttChartColumn and pass an instance of TaskToColumnTextConverter delegate where you can export the customized value with details of Successors \ Predecessor tasks.

The following sample shows both points mentioned above:

public void TestXer()
{
    var p = new Project("test.xer");
    XlsxOptions options = new XlsxOptions();
    List<ViewColumn> columns = new List<ViewColumn>();
    columns.Add(new GanttChartColumn("Id", 50, Field.TaskID));
    columns.Add(new GanttChartColumn("Name", 50, Field.TaskName));
    columns.Add(new GanttChartColumn("Successors", 50, Field.TaskSuccessors));
    columns.Add(new GanttChartColumn("Customized column", 50, CustomColumnHandler));
    options.View = new ProjectView(columns);
    p.Save("output.xlsx", options);
}

private string CustomColumnHandler(Task task)
{
    StringBuilder sb = new StringBuilder();
    foreach (var successor in task.Successors)
    {
        sb.Append(successor.Name);
        sb.Append(", ");
    }

    return sb.ToString();
}

Hi,
The above you have mentioned works for an mpp to xlsx conversion. I am looking for XER to XLSX conversion.

I want to export below fields from a P6 file into Excel
Activity ID Activity Name Original Duration Remaining Duration Start Finish Activity % Complete Physical % Complete Activity Status Primary Constraint Primary Constraint Date Activity Count Critical Activity Type Key Milestones Project Status Predecessors

Can you please advise? Is there something else we need to do for an XER file?

@abhargava ,
Aspose.Tasks for .NET API is based on MS Project’s model.

When project is imported from Primavera’s format, the values of Primavera’s fields are imported to existing properties of Task \ ResourceAssignment \ Resource entities.

This article explain mapping of some properties:

If you have any further questions, feel free to ask them.

My main question is regarding Activity.ID. How can I get that?
It is not mentioned in the document. Please point me to the activity related fields.

@abhargava ,
Activity ID is mapped to Task.PrimaveraProperties.ActivityId