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:
| 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 DescriptionThe Page class allows you to access the pages in templates that Reporter currently has open. |
Constructornew Page(template[Template], options (optional)[object])DescriptionCreate a new Page.. |
Template to create page in
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) |
ReturnsPage object Return typePage |
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. DescriptionCreate a new Page. |
Template to create page in
Name for page (empty if omitted)
ReturnsPage object Return typePage |
ExampleTo create a new blank Page object in template t: var page = new Page(t);
|
Details of functionsDeleteItem(index[integer])DescriptionDeletes an item from a page. |
The index of the item that you want to delete. Note that indices start at 0.
ReturnsNo return value |
ExampleTo delete the first item of page p: p.DeleteItem(0);
|
Duplicate(index (optional)[integer])DescriptionDuplicate a page |
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.
ReturnsPage object Return typePage |
ExampleTo 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()DescriptionGenerate a page |
No arguments
Returnsno return value |
ExampleTo generate page p: p.Generate();
|
GetAllItems()DescriptionGets all of the items from a page. |
No arguments
ReturnsArray of Item objects Return typeArray |
ExampleTo get all of the items on page p: var items = p.GetAllItems();
|
GetItem(index[integer])DescriptionGet an item from a page. |
The index of the item on the page that you want to get. Note that indices start at 0.
ReturnsReturn typeItem |
ExampleTo get the 1st item on page p: p.GetItem(0);
|
ImportItem(filename[string])DescriptionImport an item from a file onto the page. |
File containing the object to import
ReturnsReturn typeItem |
ExampleTo read an item from file "item.oro" and put it on page p: p.ImportItem("item.oro");
|