Browse our Products

Aspose.Tasks for C++ 21.5 Release Notes

All Changes

KeySummaryIssue Type
TASKSNET-4832Add an API to specify View object to render when saving project to PDF, HTML and Image formatsNew Feature
TASKSNET-4807Add support for rendering Left\Top\Inside\Bottom text labels for task bars in Gantt chartEnhancement
TASKSNET-4851Fix exception when trying to get Project using ProjectServerManagerBug
TASKSNET-4758Fix non-detailed general error message when trying to retrieve nonexistent project from Project OnlineBug
TASKSNET-4836Fix ArgumentException while reading XML without licenseBug
TASKSNET-4828Problem with .MPP file baseline1 Finish date on saving MPPBug
TASKSNET-4827Fix logic of RenderToSinglePage when project is saved to image formatBug
TASKSNET-4824Fix an exception when reading a project if no valid license loaded.Bug
TASKSNET-4834Fix reading of tasks from Primavera XML files.Bug
TASKSNET-4389Fix display of manual duration of task after project resaveBug
TASKSNET-3742Fix cost TD are not displayed in TaskUsage\ResourceUsage view when MPP file saved by Aspose.Tasks is opened by MS ProjectBug

Public API and Backwards Incompatible Changes

The following public types were added:Description
Aspose.Tasks.Visualization.TaskBarTextConverterCustom converter of task’s data to bar text.
The following public methods and properties were added:Description
Aspose.Tasks.Saving.SaveOptions.ViewSettingsGets or sets a view () to render. You can use this options to explicitly specify which view should be saved to PDF, HTML or Image formats.
Aspose.Tasks.Visualization.BarStyle.LeftBarTextConverterGets or sets user-defined converter to get text to render on the left of the task’s bar. Overrides the value of property.
Aspose.Tasks.Visualization.BarStyle.TopBarTextConverterGets or sets user-defined converter to get text to render on the top of the task’s bar. Overrides the value of property.
Aspose.Tasks.Visualization.BarStyle.RightBarTextConverterGets or sets user-defined converter to get text to render on the right of the task’s bar. Overrides the value of property.
Aspose.Tasks.Visualization.BarStyle.BottomBarTextConverterGets or sets user-defined converter to get text to render on the bottom of the task’s bar. Overrides the value of property.
Aspose.Tasks.Visualization.BarStyle.InsideBarTextConverterGets or sets user-defined converter to get text to render inside of the task’s bar. Overrides the value of property.
Aspose.Tasks.Visualization.BarStyle.LeftFieldGets or sets a field to be displayed on the left of the bar.
Aspose.Tasks.Visualization.BarStyle.TopFieldGets or sets a field to be displayed on the top of the bar.
Aspose.Tasks.Visualization.BarStyle.RightFieldGets or sets a field to be displayed on the right of the bar.
Aspose.Tasks.Visualization.BarStyle.BottomFieldGets or sets a field to be displayed on the bottom of the bar.
Aspose.Tasks.Visualization.BarStyle.InsideFieldGets or sets a field to be displayed inside of the bar.
Aspose.Tasks.Visualization.GanttBarStyle.LeftBarTextConverterGets or sets user-defined converter to get text to render on the left of the task’s bar. Overrides the value of property.
Aspose.Tasks.Visualization.GanttBarStyle.TopBarTextConverterGets or sets user-defined converter to get text to render on the top of the task’s bar. Overrides the value of property.
Aspose.Tasks.Visualization.GanttBarStyle.RightBarTextConverterGets or sets user-defined converter to get text to render on the right of the task’s bar. Overrides the value of property.
Aspose.Tasks.Visualization.GanttBarStyle.BottomBarTextConverterGets or sets user-defined converter to get text to render on the bottom of the task’s bar. Overrides the value of property.
Aspose.Tasks.Visualization.GanttBarStyle.InsideBarTextConverterGets or sets user-defined converter to get text to render inside of the task’s bar. Overrides the value of property.
The following public methods and properties were deleted:Description
Aspose.Tasks.TableField.ParentTable

Examples and additional notes

Related issue: TASKSNET-4832 - Add an API to specify View object to render when saving project to PDF, Html and Image formats.

Now you can specify the view to render explicitly. The feature can be useful when several views were defined for the same View screen in MPP project. For example there can be several Gantt chart views with different view options defined in MPP project file. Prior to ver. 21.5:

auto project = System::MakeObject <Project > (u"TestViews.mpp");
auto saveOptions = System::MakeObject < Saving::PdfSaveOptions > ();
saveOptions->set_PresentationFormat(Aspose::Tasks::Visualization::PresentationFormat::ResourceSheet);

// If two resource sheet view are defined in TestViews.mpp, first was used.
project->Save(u"output.pdf", saveOptions);

ver. 21.5 and newer:

auto project = System::MakeObject < Project > (u"TestViews.mpp");
auto view = project->get_Views()->LINQ_First([](System::SharedPtr < View > v) -> bool
{
    return v->get_Name() == u"Customized Resource &Sheet";
});
view->get_PageInfo()->get_PageSettings()->set_IsPortrait(false);
auto saveOptions = System::MakeObject < Saving::PdfSaveOptions > ();
// view to render is specified explicitly, no need to set PresentationFormat.
saveOptions->set_ViewSettings(view);
project->Save(u"output.pdf", saveOptions);
Related issue: TASKSNET-4807 - Add support for rendering Left\Top\Inside\Bottom text labels for task bars in Gantt chart.

    auto project = System::MakeObject < Project > (u"TestGanttChartView.mpp");
    auto ganttChartView = System::DynamicCast < Aspose::Tasks::GanttChartView > (project->get_Views()->LINQ_First([](System::SharedPtr < View > v) -> bool
    {
        return v->get_Name() == u"Gantt &Chart";
    }));
    auto saveOptions = System::MakeObject < Saving::PdfSaveOptions > ();
    saveOptions->set_Timescale(Aspose::Tasks::Visualization::Timescale::DefinedInView);
    saveOptions->set_ViewSettings(ganttChartView);
    
    // Bar styles can be either task-specific (located in GanttChartView.CustomBarStyles)
    // of category-specific (located in GanttChartView.BarStyles)
    
    for (const auto& ganttBarStyle : ganttChartView->get_CustomBarStyles())
    {
        if (ganttBarStyle->get_ShowForTaskUid() != 11)
        {
            continue;
        }
        
        // For demonstration purposes we are modifying style for Task with Unique ID = 11
        ganttBarStyle->set_LeftField(Aspose::Tasks::Field::TaskName);
        // Here we set custom converter to control which text should be rendered inside the task bar.
        ganttBarStyle->set_InsideBarTextConverter(static_cast<std::function<System::String(System::SharedPtr<Task> task)>>([](System::SharedPtr<Task> task) -> System::String
        {
            return System::String(u"Hours rem.: ") + (int32_t)task->Get(Tsk::RemainingWork()).get_TimeSpan().get_TotalHours();
        }));
    }
    
    for (const auto& ganttBarStyle : ganttChartView->get_BarStyles())
    {
        if (!ganttBarStyle->get_ShowForCategories()->Contains(Aspose::Tasks::Visualization::GanttBarShowFor::Milestone))
        {
            continue;
        }
        
        // For demonstration purposes we are modifying styles applicable to milestone tasks.
        
        ganttBarStyle->set_RightField(Aspose::Tasks::Field::TaskActualFinish);
        ganttBarStyle->set_TopBarTextConverter(static_cast<std::function<System::String(System::SharedPtr<Task> task)>>([](System::SharedPtr<Task> task) -> System::String
        {
            return System::Convert::ToString(task->Get(Tsk::ActualStart()).get_Day());
        }));
    }
    
    project->Save(u"output.pdf", saveOptions);