SaveOptionsTasksFilter Property

Gets or sets the condition which is used to filter tasks rendered on Gantt, Task Sheet and Task Usage charts.

Namespace:  Aspose.Tasks.Saving
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 20.5
Syntax
public ICondition<Task> TasksFilter { get; set; }

Property Value

Type: IConditionTask
Remarks
If value is not specified the default filter is used which removes non-visible tasks -- i.e. descendant tasks of collapsed tasks.
Examples
Shows how to work task's filter while save MS Project file.
public void WorkWithTasksFilter()
{
    var project = new Project(DataDir + "CreateProject2.mpp");

    // ...
    var options = this.GetSaveOptions(PresentationFormat.GanttChart);

    // lets check the save format
    Console.WriteLine("The save format: " + options.SaveFormat);

    // ...

    // save the project as an image
    project.Save(OutDir + "WorkWithTimescaleTier_out.png", options);
}

private SaveOptions GetSaveOptions(PresentationFormat format)
{
    var options = new PdfSaveOptions
                      {
                          PresentationFormat = format,
                          PageSize = PageSize.A3,
                          StartDate = new DateTime(2010, 7, 1),
                          EndDate = new DateTime(2010, 9, 1),

                          // set a task filter to skip task 'Task5' and 'Task3'
                          TasksFilter = new CustomTasksFilter()
                      };
    return options;
}

/// <summary>
/// Example of custom task filter that can be used while saving MS Project file (for instance) in PDF file.
/// </summary>
/// <inheritdoc />
internal class CustomTasksFilter : ICondition<Task>
{
    public bool Check(Task el)
    {
        return el.Get(Tsk.Name) != "Task5" && el.Get(Tsk.Name) != "Task3";
    }
}
See Also