움직이는 작업

Microsoft Project를 사용하면 다른 작업 하에서 하나의 작업을 이동할 수 있습니다. 이 경우 선택된 작업의 자식 작업도 이동합니다. Aspose.Tasks for .net은 다른 작업 하에서 작업을 이동시켜 동일한 기능을 제공합니다. 이 기사에서 볼 수 있듯이 새 부모의 자녀에게 선택된 작업을 추가하여이를 달성 할 수 있습니다. 작업은 다른 부모 또는 동일한 부모로 이동할 수 있습니다.

다른 부모 아래에서 작업 이동

1Project project = new Project("New Project.mpp");
2project.CalculationMode = CalculationMode.Automatic;
3// Get Tasks by Ids
4Task task1 = project.RootTask.Children.GetByUid(6);
5Task task2 = project.RootTask.Children.GetByUid(3);
6// Adding Task 6 to another parent
7task2.Children.Add(task1);
8project.Save("MoveTaskUnderAnotherParent_out.mpp", SaveFileFormat.MPP);

Moving Task Under the Same Parent

The MoveToSibling method allows moving a task under the same parent to a specific position.

1Project project = new Project("New Project.mpp");
2// Move tasks with id 5 before task with id 3
3Task task = project.RootTask.Children.GetById(5);
4task.MoveToSibling(3);
5project.Save("MoveTaskUnderSameParent_out.mpp", SaveFileFormat.MPP);

Add Task To The End

To add a task to the end of the collection use -1.

1Project project = new Project("New Project.mpp");
2// Move tasks with id 2 to the end of the collection
3Task task = project.RootTask.Children.GetById(2);
4task.MoveToSibling(-1);
5project.Save("MoveTaskAtTheEnd_out.mpp", SaveFileFormat.MPP);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.