Hello,
I’ve attached a MPP file (zipped) that contains three tasks two of which are incorrectly identified as Summary tasks (Task.IsSummary = true). The Tasks were created and the file was saved with the Aspose.Tasks .NET API.
What logic does your API use to determine if a task is a summary task? Is there anyway to explicitly set the IsSummary property to false when creating a Task object? This property seems to be read-only.
Thank you.
Hi Charles,
Thank you for contacting Aspose support.
Aspose.Tasks reads IsSummary property from the project file to set this flag. I have tested your sample file and observed the issue as you mentioned. Following is the sample code which can be used to create projects with summary tasks and then display IsSummary flag for confirmation. Could you please give a try to the following sample for your reference?
static public void TestTasks3()
{
Project project = new Project();
Task phase1 = project.AddTask(“Phase1”);
Task phase2 = project.AddTask(“Phase2”);
Task phase3 = project.AddTask(“Phase3”);
Task task1 = project.AddTask(“Task1”, 2);
Task task2 = project.AddTask(“Task2”, 4);
Task task3 = project.AddTask(“Task3”); // adds after the last project’s task
task1.OutlineIndent();
task2.OutlineIndent();
task3.OutlineIndent();
project.Save(“Sample.xml”, SaveFileFormat.XML);
}
public static void TestIsSummary()
{
Project prj = new Project(@“Sample.xml”);
// Create a ChildTasksCollector instance
ChildTasksCollector collector = new ChildTasksCollector();
// Collect all the tasks from RootTask using TaskUtils
TaskUtils.Apply(prj.RootTask, collector, 0);
// Parse through all the collected tasks
foreach (Aspose.Tasks.Task tsk in collector.Tasks)
{
Console.WriteLine("Name = " + tsk.Name);
Console.WriteLine("Summary = " + tsk.IsSummary);
}
}