Create Project and save as PDF

Hello,

Iam having problem with creating simple Project and then saving it to pdf. Whenever I do this the result pdf contains only 1 element which is project without any milestones or tasks. To be clear I dont want to open existing mpp file and then save it. I want to create new project from the scratch using aspose api and then save it to pdf.

I atttached example of project saved to xml and same project saved to pdf.

Hi Jakub,


Thank you for contacting Aspose support team.

This issue is reproduced here and logged under Id: TASKS-34602 for further investigation by the product team. You will be automatically notified once any update is received in this regard.

Hi Jakub,

You may please set Tsk.IsExpanded property to true for the summary task. This property determines whether a summary task is expanded or not in GanttChart View. Please give a try to the following sample code and let us know the feedback.

Project project = new Project();
project.Set(Prj.StartDate, new DateTime(2016, 9, 24));
Aspose.Tasks.Task task = project.RootTask.Children.Add("Parent Task");
task.Set(Tsk.IsExpanded, new NullableBool(true));//NOTE THIS LINE
for (int i = 0; i < 5; i++)
{
    Resource person1 = project.Resources.Add("Person " + i);
    Aspose.Tasks.Task task1 = task.Children.Add("Task " + i);
    task1.Set(Tsk.Type, TaskType.FixedDuration);
    task1.Set(Tsk.DurationFormat, TimeUnitType.Day);
    ResourceAssignment assn1 = project.ResourceAssignments.Add(task1, person1);
    assn1.Set(Asn.WorkContour, WorkContourType.Contoured);
    TimephasedData td = new TimephasedData();
    td.Start = new DateTime(2016, 9, 24, 8, 0, 0);
    td.Finish = td.Start.AddDays(1);
    td.TimephasedDataType = TimephasedDataType.AssignmentRemainingWork;
    td.Value = TimeSpanToTDString(TimeSpan.FromHours(0));
    td.Unit = TimeUnitType.Hour;
    td.Uid = assn1.Get(Asn.Uid);
    assn1.TimephasedData.Add(td);
    Console.WriteLine(i);
}

PdfSaveOptions options = new PdfSaveOptions();
project.Save("output.pdf", options);