GetPageCount

GetPageCount(SaveOptions)

Returns page count for the project to be rendered using given SaveOptions.

public int GetPageCount(SaveOptions saveOptions)
Parameter Type Description
saveOptions SaveOptions The save options to get page count for.

Return Value

a page count to be rendered.

Examples

In this example instance of HtmlSaveOptions and the number of pages in resulting HTML is written to the console.

[C#]
Project project = new Project(@"test.mpp");
HtmlSaveOptions saveOptions = new HtmlSaveOptions
{
    IncludeProjectNameInPageHeader = false,
    IncludeProjectNameInTitle = false,
    PageSize = PageSize.A4,
    Timescale = Timescale.Days,
    StartDate = project.Get(Prj.StartDate).Date,
    EndDate = project.Get(Prj.FinishDate).Date
};

Console.WriteLine(project.GetPageCount(saveOptions));

Shows how to get page count for specific save options.

var project = new Project(DataDir + "GetNumberOfPages.mpp");
var options = new HtmlSaveOptions
                  {
                      IncludeProjectNameInPageHeader = false,
                      IncludeProjectNameInTitle = false,
                      PageSize = PageSize.A4,
                      Timescale = Timescale.Days,
                      StartDate = project.Get(Prj.StartDate).Date,
                      EndDate = project.Get(Prj.FinishDate).Date
                  };

Console.WriteLine(project.GetPageCount(options));

See Also


GetPageCount()

Returns page count for the project to be rendered using default Timescale(Days).

public int GetPageCount()

Return Value

Page count to be rendered.

Examples

Shows how to get page count for different timescales.

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

// Get number of pages, Timescale.Months, Timescale.ThirdsOfMonths
var pageCount = project.GetPageCount();
Console.WriteLine("Page count: " + pageCount);
pageCount = project.GetPageCount(Timescale.Months);
Console.WriteLine("Page count (Month): " + pageCount);
pageCount = project.GetPageCount(Timescale.ThirdsOfMonths);
Console.WriteLine("Page count (Thirds of Months): " + pageCount);

See Also


GetPageCount(Timescale)

Returns page count for the project to be rendered using given Timescale.

public int GetPageCount(Timescale scale)
Parameter Type Description
scale Timescale The scale to get page count for.

Return Value

Page count to be rendered.

Examples

Shows how to get page count for different timescales.

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

// Get number of pages, Timescale.Months, Timescale.ThirdsOfMonths
var pageCount = project.GetPageCount();
Console.WriteLine("Page count: " + pageCount);
pageCount = project.GetPageCount(Timescale.Months);
Console.WriteLine("Page count (Month): " + pageCount);
pageCount = project.GetPageCount(Timescale.ThirdsOfMonths);
Console.WriteLine("Page count (Thirds of Months): " + pageCount);

See Also


GetPageCount(PresentationFormat)

Returns page count for the project to be rendered using default Timescale(Days) and given PresentationFormat

public int GetPageCount(PresentationFormat format)
Parameter Type Description
format PresentationFormat The format to get page count for.

Return Value

Page count to be rendered.

Examples

Shows how to get count of pages by presentation format and timescale.

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

// Get number of pages for Days (by default), Months and ThirdsOfMonths
Console.WriteLine("Number of Pages = '{0}'", project.GetPageCount(PresentationFormat.ResourceUsage));
Console.WriteLine("Number of Pages = '{0}'", project.GetPageCount(PresentationFormat.ResourceUsage, Timescale.Days));
Console.WriteLine("Number of Pages = '{0}'", project.GetPageCount(PresentationFormat.ResourceUsage, Timescale.Months));
Console.WriteLine("Number of Pages = '{0}'", project.GetPageCount(PresentationFormat.ResourceUsage, Timescale.ThirdsOfMonths));

See Also


GetPageCount(PresentationFormat, Timescale)

Returns page count for the project to be rendered using given Timescale and PresentationFormat.

public int GetPageCount(PresentationFormat format, Timescale scale)
Parameter Type Description
format PresentationFormat The format to get page count for.
scale Timescale The scale to get page count for.

Return Value

a page count to be rendered.

Examples

Shows how to get count of pages by presentation format and timescale.

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

// Get number of pages for Days (by default), Months and ThirdsOfMonths
Console.WriteLine("Number of Pages = '{0}'", project.GetPageCount(PresentationFormat.ResourceUsage));
Console.WriteLine("Number of Pages = '{0}'", project.GetPageCount(PresentationFormat.ResourceUsage, Timescale.Days));
Console.WriteLine("Number of Pages = '{0}'", project.GetPageCount(PresentationFormat.ResourceUsage, Timescale.Months));
Console.WriteLine("Number of Pages = '{0}'", project.GetPageCount(PresentationFormat.ResourceUsage, Timescale.ThirdsOfMonths));

See Also


GetPageCount(PageSize, Timescale, DateTime, DateTime)

Returns page count for the project to be rendered using given Timescale, PresentationFormat and date range.

public int GetPageCount(PageSize pageSize, Timescale scale, DateTime startDate, DateTime endDate)
Parameter Type Description
pageSize PageSize The size to get page count for.
scale Timescale The scale to get page count for.
startDate DateTime The start date to get page count for.
endDate DateTime The end date to get page count for.

Return Value

Page count to be rendered.

Examples

Shows how to get count of pages by page size, timescale, start and finish dates.

var project = new Project(DataDir + "GetNumberOfPages.mpp");
var pageCount = project.GetPageCount(
    PageSize.A3,
    Timescale.Months,
    project.Get(Prj.StartDate) - TimeSpan.FromDays(10),
    project.Get(Prj.FinishDate) + TimeSpan.FromDays(30));

Console.WriteLine(pageCount);

See Also


GetPageCount(PageSize, Timescale)

Returns page count for the project to be rendered using given Timescale and PageSize.

public int GetPageCount(PageSize pageSize, Timescale scale)
Parameter Type Description
pageSize PageSize The size to get page count for.
scale Timescale The scale to get page count for.

Return Value

Page count to be rendered.

Examples

Shows how to get count of pages by a page size and a timescale.

var project = new Project(DataDir + "GetNumberOfPages.mpp");
var pageCount = project.GetPageCount(PageSize.A3, Timescale.Months);

Console.WriteLine(pageCount);

See Also