Setting a Task to A SubProject
Microsoft Project provides the option to set a task to another project, known as a sub-project to the parent project. Aspose.Tasks for Java API provides the same capability to set a task to another sub-project using the Tsk.SubProjectName property.
Setting a Task to a SubProject
1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
2// The path to the documents directory.
3String dataDir = Utils.getDataDir(RenderTaskUsage.class);
4
5Project project = new Project(dataDir + "New Project 2010.mpp");
6
7Task task = project.getRootTask().getChildren().add("Task 1");
8
9// setting new subproject link
10task.set(Tsk.SUBPROJECT_NAME, dataDir +"NewProductDev.mpp");
11
12// you can see the result in the attached screenshot
13project.save("Link.mpp", SaveFileFormat.MPP);
14