Page class

The Page class gives access to pages in Reporter. More...

The REPORTER JavaScript API provides many class constants, properties and methods. For Arup to be able to extend and enhance the API in the future any constant, property or method names beginning with a lowercase or uppercase letter are reserved.
If you need to add your own properties or methods to one of the existing classes then to avoid any potential future conflict you should ensure that the name begins with either an underscore (_) or a dollar sign ($) or the name is prefixed with your own unique identifier.
For example if company 'ABC' need to add a property called 'example' then to avoid any potential future conflict use one of:

Member functions

Page properties

Name Type Description
generating (read only) logical true if the entire page is currently being generated
items (read only) integer The total number of items on the page
master (read only) logical true if this is a master page object.
name string Name of the Page

Detailed Description

The Page class allows you to access the pages in templates that Reporter currently has open.

Constructor

new Page(template[Template], options (optional)[object])

Description

Create a new Page..

Arguments

  • template (Template)

    Template to create page in

  • options (optional) (object)

    Options specifying various page properties, including where the page should be created. If omitted, the default values below will be used.

    Object has the following properties:

    Name Type Description
    colour (optional) Colour object Page background colour (white if omitted)
    index (optional) integer The page index at which the new page will be inserted (indices start from zero). You cannot create pages prior to the current page i.e. the index must be greater than the index of the current page. If omitted, the new page will be created immediately after the current page. Note that the current page continues to be the page that the Script item is running on (it does not change to the newly-created page).
    name (optional) string Name for page (empty if omitted)

    Returns

    Page object

    Return type

    Page

    Example

    To create a new blank Page object in template t:

    var page = new Page(t);

    To create a new red page named "Last page" as the last page in template t:

    var page = new Page(t, {name:"Last page", colour:Colour.Red(),
    index:t.GetAllPages().length});

    new Page(template[Template], name (optional)[string])   [deprecated]

    This function is deprecated in version 17.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.

    Description

    Create a new Page.

    Arguments

  • template (Template)

    Template to create page in

  • name (optional) (string)

    Name for page (empty if omitted)

    Returns

    Page object

    Return type

    Page

    Example

    To create a new blank Page object in template t:

    var page = new Page(t);

    Details of functions

    DeleteItem(index[integer])

    Description

    Deletes an item from a page.

    Arguments

  • index (integer)

    The index of the item that you want to delete. Note that indices start at 0.

    Returns

    No return value

    Example

    To delete the first item of page p:

    p.DeleteItem(0);


    Duplicate(index (optional)[integer])

    Description

    Duplicate a page

    Arguments

  • index (optional) (integer)

    The page index that you want to insert the duplicate page at in the template. Note that indices start at 0. If omitted the duplicate page will be put after the one that you are duplicating.

    Returns

    Page object

    Return type

    Page

    Example

    To duplicate page p:

    var dp = p.Duplicate();

    To duplicate page p putting the duplicate as the first page in the template:

    var dp = p.Duplicate(0);


    Generate()

    Description

    Generate a page

    Arguments

    No arguments

    Returns

    no return value

    Example

    To generate page p:

    p.Generate();


    GetAllItems()

    Description

    Gets all of the items from a page.

    Arguments

    No arguments

    Returns

    Array of Item objects

    Return type

    Array

    Example

    To get all of the items on page p:

    var items = p.GetAllItems();


    GetItem(index[integer])

    Description

    Get an item from a page.

    Arguments

  • index (integer)

    The index of the item on the page that you want to get. Note that indices start at 0.

    Returns

    Item

    Return type

    Item

    Example

    To get the 1st item on page p:

    p.GetItem(0);


    ImportItem(filename[string])

    Description

    Import an item from a file onto the page.

    Arguments

  • filename (string)

    File containing the object to import

    Returns

    Item

    Return type

    Item

    Example

    To read an item from file "item.oro" and put it on page p:

    p.ImportItem("item.oro");