Support Questions - Aspose.Tasks

Before using this product I was wondering if the following was supported


  1. Support for multiple predecessors per task
  2. Ability to render output from aspx web form to .mpp file the same way some of the examples show for outputting xml.

Hi Mark,

Thank you for considering Aspose.Tasks

markf013:

  1. Support for multiple predecessors per task

Yes. Aspose.Tasks supports multiple predecessors per task. Please have a look at the following code and the attached screenshot for your reference, where Task 1 and Task 2 are assigned as predecessors of Task 3.

ProjectReader reader = new ProjectReader();
//read an empty MPP
Project project = reader.Read("Empty.mpp");
Task task1 = new Task("Task 1");
task1.Duration = new TimeSpan(8, 0, 0);
task1.Start = project.StartDate;
task1.Finish = project.Calendar.GetTaskFinishDateFromDuration(task1, task1.Duration);
Task task2 = new Task("Task 2");
task2.Duration = new TimeSpan(8, 0, 0);
task2.Start = project.StartDate;
task2.Finish = project.Calendar.GetTaskFinishDateFromDuration(task2, task2.Duration);
project.RootTask.Children.Add(task1);
project.RootTask.Children.Add(task2);
Task task3 = new Task("Task 3");
task3.Duration = new TimeSpan(8, 0, 0);
task3.Start = project.StartDate;
task3.Finish = project.Calendar.GetTaskFinishDateFromDuration(task3, task3.Duration);
project.RootTask.Children.Add(task3);
TaskLink tskLink = new TaskLink(task1, task3, TaskLinkType.FinishToStart);
project.TaskLinks.Add(tskLink);
TaskLink taskLink2 = new TaskLink(task2, task3, TaskLinkType.FinishToStart);
project.TaskLinks.Add(taskLink2);
// Necessary calculations
project.CalcTaskUids();
project.CalcTaskIds();
project.UpdateReferences();
project.Save("Testlnk1.mpp", Aspose.Tasks.Saving.SaveFileFormat.MPP);

markf013:

Ability to render output from aspx web form to .mpp file the same way some of the examples show for outputting xml.

I would like to share with you that Aspose.Tasks doesn’t provide the facility to create a new MPP file at present, but you can read and modify an MPP file using Aspose.Tasks and then save it to the disk using the Response object of ASPx as follow:

//Reading a project code goes here
//Assuming Task links have been added to project..now Save the project to stream (continued from previous example)
MemoryStream ms2 = new MemoryStream();
project.Save(ms2, Aspose.Tasks.Saving.SaveFileFormat.MPP);
byte[] buffer;
ms2.Position = 0;
buffer = ms2.ToArray(); //save in byte[] array
//write to Response
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", String.Format("attachment;filename={0}", "Test.Mpp"));
Response.ContentType = "application/vnd.ms-project";
Response.BinaryWrite(buffer);
Response.End();

If you need further information, please feel free to contact us. We will be glad to assist you further.