Writing Updated TaskLink Data to MPP in Ruby

To write Updated TaskLink Data to MPP using Aspose.Tasks Java for Ruby, simply invoke UpdateTaskLink module. Here you can see example code.

Ruby Code

 1one_sec = 10000000
 2one_min = 60 * one_sec
 3one_hour = 60 * one_min
 4project = Rjb::import('com.aspose.tasks.Project').new('test_tasks.mpp')
 5tsk = Rjb::import('com.aspose.tasks.Tsk')
 6prj = Rjb::import('com.aspose.tasks.Prj')
 7task1 = project.getRootTask().getChildren().add("1")
 8task1.set(tsk.DURATION, project.getDuration(8, Rjb::import('com.aspose.tasks.TimeUnitType').Hour))
 9task1.set(tsk.START, project.get(prj.START_DATE))
10task1.set(tsk.FINISH, project.get(prj.CALENDAR).getTaskFinishDateFromDuration(task1, task1.get(tsk.DURATION).toDouble()))
11task2 = project.getRootTask().getChildren().add("2")
12task2.set(tsk.DURATION, project.getDuration(8, Rjb::import('com.aspose.tasks.TimeUnitType').Hour))
13task2.set(tsk.START, project.get(prj.START_DATE))
14task2.set(tsk.FINISH, project.get(prj.CALENDAR).getTaskFinishDateFromDuration(task2, task2.get(tsk.DURATION).toDouble()))
15project.getRootTask().getChildren().add(task1)
16project.getRootTask().getChildren().add(task2)
17link1 = project.getTaskLinks().add(task1, task2, Rjb::import('com.aspose.tasks.TaskLinkType').StartToStart)
18project.save("TaskLinks.mpp", Rjb::import('com.aspose.tasks.SaveFileFormat').MPP)
19puts "Saved task links data."

Download Running Code

Download Writing Updated TaskLink Data to MPP (Aspose.Tasks) from any of the below mentioned social coding sites:

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.