The Template class gives access to templates 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 |
| filename (read only) | string | Filename (without path) of the Template. |
| generating (read only) | logical | true if the entire template is currently being generated |
| name (read only) | string | This property is deprecated in version 15.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. Name of the Template. This property has been preserved for compatability with older scripts. It either contains the absolute path and filename, or just the filename, depending on how the Template was opened. Please use the filename and path properties for consistent results. [deprecated] |
| pages (read only) | integer | Number of Pages in template |
| path (read only) | string | Absolute path (without filename) of the Template. If the Template is new and has not yet been saved, this property will be empty. |
| readonly (read only) | logical | true if the template is read-only |
| variables | array | This property is deprecated in version 12.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. Array of Variable objects for this template. Please use Variable.GetAll() and Variable.GetFromName() instead. [deprecated] |
| view | constant | Current view type (presentation or design view) for this Template. Can be: Reporter.VIEW_DESIGN or Reporter.VIEW_PRESENTATION. |
Detailed DescriptionThe Template class allows you to access the templates that Reporter
currently has open. |
Constructornew Template(filename (optional)[string])DescriptionCreate a new Template. The filename argument is optional. If present it is a file to open |
Name of template file to open
ReturnsTemplate object Return typeTemplate |
ExampleTo create a new blank Template object var template = new Template();
|
Details of functionsClose()DescriptionClose a template. |
No arguments
Returnsno return value |
ExampleTo close template data: data.Close();
|
DeletePage(index[integer])DescriptionDeletes a page from a template. |
The index of the page that you want to delete. Note that indices start at 0.
ReturnsNo return value |
ExampleTo delete the first page of template t: t.DeletePage(0);
|
DeleteTemporaryVariables()DescriptionDeletes any temporary variables from a template. |
No arguments
ReturnsNo return value |
ExampleTo delete all the temporary variables from template t: t.DeleteTemporaryVariables();
|
Title for dialog. If omitted, null or an empty string is given then the default title will be used.
Message to show in dialog. If omitted, null or an empty string is given then the default message will be used.
Whether the variables in the template will be updated with the new values if OK is pressed. Setting this to be false allows you to check variable values before updating them from a script. If omitted the default is true
A list of variables to show in the dialog. If omitted, null or an empty array, all variables will be shown
Columns to show in the dialog (as well as the variable value column). Can be a bitwise OR of Variable.NAME, Variable.TYPE, Variable.DESCRIPTION, Variable.FORMAT, Variable.PRECISION and Variable.TEMPORARY. If omitted columns will be shown for name and description
Whether to sort variables in the table by alphabetical order. If false, variables are listed in the order they are passed in the optional variables argument. If no variables are passed to the function, all template variables will be shown in alphabetical order. If omitted, the default value is true.
ReturnsObject containing the variable names and values or null if cancel was pressed. Return typeObject |
ExpandVariablesInString(string[string])DescriptionReplaces any variables in a string with their current values |
The string you want to expand variables in.
ReturnsString (string) with variables expanded. If a variable in a string does not exist it is replaced by a blank. Return typeString |
Generate()DescriptionGenerate a template |
No arguments
Returnsno return value |
ExampleTo generate template data: data.Generate();
|
GetAll() [static]DescriptionGet all of the open templates |
No arguments
Returnsarray of Template objects or null if no open templates Return typeArray |
ExampleTo get all of the templates open in REPORTER: var templates = Template.GetAll();
|
GetAllPages()DescriptionGets all of the pages from a template. |
No arguments
ReturnsArray of Page objects Return typeArray |
ExampleTo get all of the pages from template t: var pages = t.GetAllPages();
|
GetCurrent() [static]DescriptionGet the currently active template |
No arguments
ReturnsTemplate object or null if no active template Return typeTemplate |
ExampleTo get the current template open in REPORTER: var current_template = Template.GetCurrent();
|
GetMaster()DescriptionGet the master page from a template. |
No arguments
ReturnsPage object Return typePage |
ExampleTo get the master page of template t: var m = t.GetMaster();
|
GetPage(index[integer])DescriptionGet a page from a template. |
The index of the page that you want to get. Note that indices start at 0.
ReturnsPage object Return typePage |
ExampleTo get the first page of template t: var p = t.GetPage(0);
|
GetVariableDescription(name[string])DescriptionGet the description for a variable |
Variable name you want to get description for.
ReturnsVariable description (string) or null if variable does not exist Return typeString |
ExampleTo get description for variable FRED in template: var description = template.GetVariableDescription("FRED");
|
GetVariableValue(name[string])DescriptionGet the value for a variable |
Variable name you want to get value for.
ReturnsVariable value (string) or null if variable does not exist Return typeString |
ExampleTo get value for variable FRED in template: var value = template.GetVariableValue("FRED");
|
Html(filename[string])DescriptionSave a template as HTML |
Filename you want to save.
Returnsno return value |
ExampleTo save template data as file /data/test/template.html: data.Html("/data/test/template.html");
|
Pdf(filename[string])DescriptionSave a template as Adobe Acrobat PDF |
Filename you want to save.
Returnsno return value |
ExampleTo save template data as file /data/test/template.pdf: data.Pdf("/data/test/template.pdf");
|
Ppt(filename[string]) [deprecated]This function is deprecated in version 18.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. DescriptionSave a template as PowerPoint. This function is deprecated. Use Template.Pptx instead. |
Filename you want to save.
Returnsno return value |
ExampleTo save template data as file /data/test/template.pptx: data.Ppt("/data/test/template.pptx");
|
Pptx(filename[string])DescriptionSave a template as PowerPoint |
Filename you want to save.
Returnsno return value |
ExampleTo save template data as file /data/test/template.pptx: data.Pptx("/data/test/template.pptx");
|
Print(printer[string])DescriptionPrint template on a printer |
Printer you want to print to.
Returnsno return value |
ExampleTo print template data on printer myprinter: data.Print("myprinter");
|
Save()DescriptionSave a template |
No arguments
Returnsno return value |
ExampleTo save template data: data.Save();
|
SaveAs(filename[string], readonly (optional)[boolean])DescriptionSave a template/report with a new name |
Filename you want to save. Note if you use the .orr extension the template will be saved as a report if generated.
If saved template/report will be readonly or not.
Returnsno return value |
ExampleTo save template data as file /data/test/template.opt: data.SaveAs("/data/test/template.opt");
|
Update()DescriptionUpdate/redraw a template |
No arguments
Returnsno return value |
ExampleTo update template data: data.Update();
|