Cant change text in legend

When Project is printed to pdf in the legend left theres Project name and current date being displayed. I tried changing date but I couldn’t find which field was being inserted as date there, so then I tried to just set the whole text there myself like this:

var ganttChartView = (GanttChartView)project.Views.First(v => v.Name == "&Gantt Chart");
ganttChartView.PageInfo.Legend.LeftText = "Title: Project";
ganttChartView.PageInfo.Legend = new PageLegend
{
    LeftText = "Title: Project",
};

Tried changing it directly and with new PageLegend object, but it just doesnt react. How can i change date being displayed in legend?

@Herrington

To change the text displayed in the legend of a Gantt chart when exporting a project to PDF using Aspose.Tasks, you need to ensure that you are modifying the correct properties of the PageLegend object.

From your code, it seems you are trying to set the LeftText property directly and also by creating a new PageLegend object. However, you should modify the existing PageLegend instance instead of creating a new one. Here’s how you can do it:

  1. Access the PageInfo of the Gantt chart view.
  2. Modify the Legend properties directly.

Here’s an example of how to properly set the left text in the legend:

var ganttChartView = (GanttChartView)project.Views.First(v => v.Name == "&Gantt Chart");

// Access the existing legend
var legend = ganttChartView.PageInfo.Legend;

// Modify the left text
legend.LeftText = "Title: Project";

// If you want to change the date, you can set it here as well
legend.RightText = DateTime.Now.ToString("MM/dd/yyyy"); // Example of setting the current date

// Save the project to reflect changes
project.Save("output.mpp", SaveFileFormat.Mpp);

Make sure to save the project after making changes to ensure that they are reflected in the output PDF. If you want to display the current date, you can format it as needed and assign it to the RightText property or any other relevant property in the PageLegend.

If you continue to experience issues, ensure that the project file is being saved correctly and that there are no other settings overriding your changes.

For more detailed information on configuring page legends, you can refer to the documentation on managing MS Project page legends with Aspose.Tasks here.

Sources:
[1]: Configuring MS Project Legends in Aspose.Tasks

@Herrington,
we were able to reproduce the issue.
The following new ticket was opened in our internal issue tracking system. We will deliver the fix according to the terms mentioned in Free Support Policies.

Issue ID(s): TASKSNET-11351

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@vasiliy.sinitsyn ,

Is there some workaround for this?

@Herrington ,
we haven’t managed to find the workaround for the issue.