Summary styles dont get applied

Im trying to set Task as Summary by setting IsSummary as true, i would expect all Summary TextStyles to get applied if that is the case, however this does not happen. Perhaps im doing it wrong?

@Herrington

It seems you are trying to set a task as a summary by using the IsSummary property, but the expected text styles for summary tasks are not being applied. This can sometimes happen if the text styles are not configured correctly or if there are specific settings that need to be adjusted.

To ensure that the summary text styles are applied correctly, you should follow these steps:

  1. Check Text Style Configuration: Make sure that you have defined the text styles for summary tasks in your project. You can customize text styles in Aspose.Tasks to enhance the visual representation of your project documents.

  2. Apply Styles After Setting IsSummary: After setting the IsSummary property to true, ensure that you explicitly apply the desired text styles to the summary task. Sometimes, styles may not automatically propagate to summary tasks, and you may need to set them manually.

  3. Review Documentation: It may be helpful to refer to the Aspose.Tasks documentation on configuring text styles. This can provide insights into how to properly set up and apply styles to different task types, including summary tasks.

If you continue to experience issues, consider sharing a code snippet of your implementation. This will help in diagnosing the problem more effectively.

For more detailed guidance on text and view configuration, you can refer to the Aspose.Tasks documentation here.

If you have any further questions or need additional assistance, feel free to ask!

@Herrington ,

it doesn’t work that way. In order to make task summary you should add child task(s) to it.

@vasiliy.sinitsyn
Hi, i tried overcoming this by adding dummy childs to task and then setting IsExpanded to false, but it seems that it doesnt work with CalculationMode set to none, is this a bug or intended?

@Herrington ,
I’ve tried the following code and summary style is applied:

var p = new Project();
p.CalculationMode = CalculationMode.None;
var t = p.RootTask.Children.Add("Summary");
t.Start = p.StartDate;
t.Duration = p.GetDuration(10, TimeUnitType.Day);
t.Finish = p.FinishDate;
t.Children.Add("Child1");
t.IsExpanded = false;
p.Save("output.pdf", SaveFileFormat.Pdf);

@vasiliy.sinitsyn

I have managed to reproduce this issue with the latest Aspose.Tasks version

Project project = new Project();

SaveOptions options = new PdfSaveOptions();
project.CalculationMode = CalculationMode.None;

Aspose.Tasks.Task task = project.RootTask.Children.Add("task1");

task.Children.Add("subtask1");
task.Children.Add("subtask2");
task.Children.Add("subtask3");

Aspose.Tasks.Task task2 = project.RootTask.Children.Add("task2");

var t =  task2.Children.Add("subtask1");
t.Children.Add("subtask1");
t.Children.Add("subtask2");
t.Children.Add("subtask3");
task2.Children.Add("subtask2");

task.IsExpanded = false;
task2.IsExpanded = false;
t.IsExpanded = false;

project.Save("project_test.pdf", options);

@Herrington ,
when CalculationMode.None is used, only necessary properties of tasks are set by Aspose.Tasks, calculations of related properties are not performed.
Thus all tasks in the resulting project have zero durations and therefore, are not rendered.

You should set Id, Duration, Start and Finish of the tasks as in my example:

Project project = new Project();

SaveOptions options = new PdfSaveOptions();
project.CalculationMode = CalculationMode.None;
project.StartDate = new DateTime(2024, 9, 17, 9, 0, 0);

Aspose.Tasks.Task task = project.RootTask.Children.Add("task1");
task.Id = 1;
task.Start = new DateTime(2024, 9, 17, 9, 0, 0);
task.Duration = project.GetDuration(2, TimeUnitType.Day);
task.Finish = new DateTime(2024, 9, 19, 9, 0, 0);

var st = task.Children.Add("subtask1");
st.Id = 2;
st = task.Children.Add("subtask2");
st.Id = 3;
st = task.Children.Add("subtask3");
st.Id = 4;

Aspose.Tasks.Task task2 = project.RootTask.Children.Add("task2");
task2.Start = new DateTime(2024, 9, 17, 9, 0, 0);
task2.Duration = project.GetDuration(2, TimeUnitType.Day);
task2.Finish = new DateTime(2024, 9, 19, 9, 0, 0);

task2.Id = 5;
var t = task2.Children.Add("subtask1");
t.Id = 6;
st = t.Children.Add("subtask1");
st.Id = 7;
st = t.Children.Add("subtask2");
st.Id = 8;
st = t.Children.Add("subtask3");
st.Id = 9;
st = task2.Children.Add("subtask2");
st.Id = 10;

task.IsExpanded = false;
task2.IsExpanded = false;
//t.IsExpanded = false;

project.Save("project_test.pdf", options);