LegendDrawingOptions

SaveOptions.LegendDrawingOptions property

Gets or sets a value which define how to render a legend. Default value is LegendDrawingOptions.OnEveryPage.

public LegendDrawingOptions LegendDrawingOptions { get; set; }

Examples

Shows how to print legend on last page

var project = new Project(DataDir + "CreateProject2.mpp");
SaveOptions options = new PdfSaveOptions
{
    // Take legend drawing options from view
    LegendDrawingOptions = LegendDrawingOptions.AfterLastPage
};

project.Save(OutDir + "LegendOnSeparatePage_out.pdf", options);

Shows how to hide page legends.

var project = new Project(DataDir + "CreateProject2.mpp");
SaveOptions options = new PdfSaveOptions
{
    // Specify LegendDrawingOptions.NoLegend to hide legends
    LegendDrawingOptions = LegendDrawingOptions.NoLegend
};

project.Save(OutDir + "HideLegendsDuringSave_out.pdf", options);

Shows how to use LegendDrawingOptions.DefinedInView option.

var project = new Project(DataDir + "CreateProject2.mpp");

var view = project.Views.GetByName("&Gantt Chart");

Console.WriteLine("LegendOn option defined in view '{0}': {1}", view.Name, view.PageInfo.Legend.LegendOn);

SaveOptions options = new PdfSaveOptions
{
    // Take legend drawing options from the view
    LegendDrawingOptions = LegendDrawingOptions.DefinedInView,
    ViewSettings = view
};

project.Save(OutDir + "Legend_DefinedInView.pdf", options);

See Also