PageInfo.Legend
Contents
[
Hide
]PageInfo.Legend property
Gets or sets an instance of the PageLegend
class which specifies rendering options of page legend.
public PageLegend Legend { get; set; }
Remarks
Currently is applicable only to Gantt Chart views.
Examples
Shows how to work with page legend information.
var project = new Project(DataDir + "Blank2010.mpp");
// lets read page legend information
var legend = project.DefaultView.PageInfo.Legend;
Console.WriteLine("Legend left text: {0} ", legend.LeftText);
Console.WriteLine("Legend left image: {0} ", legend.LeftImage);
Console.WriteLine("Legend center text: {0} ", legend.CenteredText);
Console.WriteLine("Legend center image: {0} ", legend.CenteredImage);
Console.WriteLine("Legend right text: {0} ", legend.RightText);
Console.WriteLine("Legend right image: {0} ", legend.RightImage);
Console.WriteLine("Legend On: {0} ", legend.LegendOn);
Console.WriteLine("Legend Width: {0} ", legend.Width);
// also modification of a legend is supported
legend.LeftText = "New Left Text";
project.Save(OutDir + "WorkWithPageLegend_out.mpp", SaveFileFormat.Mpp);
Shows how to work with page info of MS Project view.
var project = new Project(DataDir + "Project2.mpp");
// lets modify the default view
var info = project.DefaultView.PageInfo;
Console.WriteLine("Modify Page Info: " + info.Name);
// lets modify margins
info.Margins.Left = 10d;
info.Margins.Top = 10d;
info.Margins.Right = 10d;
info.Margins.Bottom = 10d;
// lets modify page settings
info.PageSettings.IsPortrait = true;
info.PageSettings.PaperSize = PrinterPaperSize.PaperA4;
// lets modify page view settings
// set a value indicating whether to print notes.
info.PageViewSettings.PrintNotes = true;
var header = new HeaderFooterInfo
{
LeftText = "Left header text",
CenteredText = "Centered header text",
RightText = "Right header text"
};
var legend = new PageLegend
{
LeftText = "Left legend text",
CenteredText = "Centered legend text",
RightText = "Right legend text"
};
var footer = new HeaderFooterInfo
{
LeftText = "Left footer text",
CenteredText = "Centered footer text",
RightText = "Right footer text"
};
info.Header = header;
info.Legend = legend;
info.Footer = footer;
// work with project...
See Also
- class PageLegend
- class PageInfo
- namespace Aspose.Tasks.Visualization
- assembly Aspose.Tasks