Hello,
I have searched for information regarding modifying the font properties of the text fields in the Gantt view, but I haven’t been able to find any relevant details. Is it possible to change the font settings?
Version Aspose.Tasks 24.9.0
Project project = new Project();
project.StartDate = new DateTime(2024, 9, 14, 8, 0, 0);
var startDate = new DateTime(2024, 9, 16, 8, 0, 0);
var endDate = new DateTime(2024, 9, 24, 17, 0, 0);
Task parentTask = project.RootTask;
Task child1 = parentTask.Children.Add("Task 1");
child1.Duration = project.GetDuration(5, TimeUnitType.Day);
Task child2 = parentTask.Children.Add("Task 2");
child2.Duration = project.GetDuration(6, TimeUnitType.Day);
child1.Baselines.Add(new TaskBaseline(child1)
{
BaselineNumber = BaselineType.Baseline,
Start = startDate,
Finish = endDate
});
child2.Baselines.Add(new TaskBaseline(child2)
{
BaselineNumber = BaselineType.Baseline,
Start = startDate,
Finish = endDate
});
var ganttChartView = project.DefaultView as GanttChartView;
if (ganttChartView != null)
{
GanttBarStyle baselineStyle = new GanttBarStyle();
baselineStyle.ShowForCategories = new List<GanttBarShowFor>();
baselineStyle.ShowForCategories.Add(GanttBarShowFor.Active);
baselineStyle.ShowForCategories.Add(GanttBarShowFor.Normal);
baselineStyle.From = Field.TaskBaselineStart;
baselineStyle.To = Field.TaskBaselineFinish;
baselineStyle.MiddleShape = GanttBarMiddleShape.LineBottom;
baselineStyle.MiddleShapeColor = Color.Gray;
ganttChartView.BarStyles.Add(baselineStyle);
//Set the right field for displaying task notes
gantt.BarStyles.ForEach(barstyle => taskStyle.RightField = Field.TaskSheetNotes);
}
PdfSaveOptions options = new PdfSaveOptions()
{
ViewSettings = ganttChartView
};
project.Save("output.pdf", options);