Project.GetPageCount

GetPageCount(SaveOptions)

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

public int GetPageCount(SaveOptions saveOptions)
ParameterTypeDescription
saveOptionsSaveOptionsThe 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)
ParameterTypeDescription
scaleTimescaleThe 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)
ParameterTypeDescription
formatPresentationFormatThe 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)
ParameterTypeDescription
formatPresentationFormatThe format to get page count for.
scaleTimescaleThe 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)
ParameterTypeDescription
pageSizePageSizeThe size to get page count for.
scaleTimescaleThe scale to get page count for.
startDateDateTimeThe start date to get page count for.
endDateDateTimeThe 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)
ParameterTypeDescription
pageSizePageSizeThe size to get page count for.
scaleTimescaleThe 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