How to apply GanttBarStyle to Manual Summary Rollup?

Hi,

The bar styles of summary task don’t work as expected in the gantt chart view unless I clear the fields and reset them manually, but the behaviors of sub tasks are normal, how can I fix it?

string dataDir = "./";
Project project = new Project("Blank2010.mpp") { CalculationMode = CalculationMode.Manual };

Task child1 = project.RootTask.Children.Add("Child 1");
child1.Set(Tsk.Start, new DateTime(2017, 9, 6, 8, 0, 0));
child1.Set(Tsk.Duration, project.GetDuration(5, TimeUnitType.Day));

var child2 = child1.Children.Add("Child 1");
child2.Set(Tsk.Start, new DateTime(2017, 9, 6, 8, 0, 0));
child2.Set(Tsk.Duration, project.GetDuration(1, TimeUnitType.Day));
project.ResourceAssignments.Add(child2, project.Resources.Add("Rsc1"));

if (project.DefaultView is GanttChartView view)
{
    var bss = view.BarStyles.Where(a => a.Name.Contains("Manual"));
    bss.ForEach(bs =>
    {
        bs.TopField = Field.TaskName;
        bs.BottomField = Field.TaskResourceNames;
        bs.LeftField = Field.TaskStart;
        bs.RightField = Field.TaskFinish;
    });
}

string file = "ImplementCustomBarStyleWriting_out.mpp";

MPPSaveOptions options = new MPPSaveOptions();
options.WriteViewData = true;
project.Recalculate();

project.Save(dataDir + file, options);

NoSummaryStyles.png (84.3 KB)

Thanks.

@anobaka,

Thank you for contacting Aspose support team again.

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

@anobaka,

The issue logged as TASKSNET-2097 has been fixed in this monthly release of API.

Hello Aspose team,

Although we’re using the 19.4 version of Aspose.Tasks, we’re facing the same issue when it comes to Summary Tasks or milestones : we’re applying colors to the task bars, whether they are plain tasks, summary tasks, or milestones, but unfortunately, the custom bar styles only apply to plain tasks, the other bars are simply ignored.

Aspose CustomBarStyles.png (10.6 KB)

Please find below the code used to generate the custom bar styles.

    private static GanttBarStyle GetCustomBarStyle(Aspose.Tasks.Task task, Color color)
    {
        GanttBarStyle style = new GanttBarStyle();

        style.ShowFor = task.Get(Tsk.Uid).ToString();

        style.MiddleShape = GanttBarMiddleShape.RectangleBar;
        style.MiddleFillPattern = GanttBarFillPattern.SolidFill;
        style.MiddleShapeColor = color;

        style.StartShapeType = GanttBarType.Solid;
        style.StartShape = GanttBarEndShape.NoBarEndShape;
        style.StartShapeColor = color;

        style.EndShapeType = GanttBarType.Solid;
        style.EndShape = GanttBarEndShape.NoBarEndShape;
        style.EndShapeColor = color;

        return style;
    }

Are we missing something particular, or is this still a bug ?

Thanks in advance.

@Rag3lib

Can you please share complete sample project along with source file and generated result so that we may further investigate to help you out.