Form Engine Classes
    • 30 Jan 2026
    • 6 Minutes to read
    • Contributors
    • PDF

    Form Engine Classes

    • PDF

    Article summary

    Applies to: Lasernet 11

    Grab

    Description

    The Grab class is used in the Form Engine to provide basic access to the input and output grab areas. The Grab class is automatically instantiated by the grab object. It is not possible to instantiate the Grab from script.

    Properties

    currentPage

    Description

    Returns the number of the output page currently being handled. Pages are numbered from 1. This property returns the same value as the variable CurrentPage.

    Access

    Read

    Returns

    Number

    Example

    var PageCurrent = grab.currentPage;

    currentSheet

    Description

    Returns the number of the current sheet being handled. Sheets are numbered from 1.

    Access

    Read

    Returns

    Number

    Example

    var SheetCurrent = grab.currentSheet;

    lineCount

    Description

    Returns the number of lines in the input grab area. Can be used in connection with the getText method to loop through the lines in the grab area.

    Access

    Read

    Returns

    Number

    Example

    maxWidth

    Description

    Returns the width of the widest line in the input grab area. The width of a line is defined as the rightmost column with a non-space character.

    Access

    Read

    Returns

    Number

    Example

    numberOfPages

    Description

    Returns the total number of pages generated for text output.

    Access

    Read

    Returns

    Number

    Example

    type

    Description

    Always returns the value Grab.

    Access

    Read

    Returns

    String

    Example

    conditionalHeight

    Description

    Access

    Read

    Returns

    Number

    Example

    conditionalStart

    Description

    Access

    Read

    Returns

    Number

    Example

    conditionalEnd

    Description

    Access

    Read

    Returns

    Number

    Example

    conditionalFooter

    Description

    Access

    Read

    Returns

    Number

    Example

    Methods

    getText

    Description

    Retrieves text directly from the input grab area. If height is bigger than 1 then multiple lines will be returned separated by CR (hex 0D). The last line will not have an ending CR. All lines will be padded with spaces up to the given width.

    Parameters

    line : Number

    column : Number

    width : Number

    [height : Number = 1]

    Returns

    String

    Example

    setChartData

    Description

    Sets the ChartData ChartDataName to value. If replace is true all current ChartData in the list is cleared. The default value of replace is true.

    Parameters

    ChartDataName : String

    value : String

    [replace : Boolean]

    Returns

    None

    Example

    grab.setChartData("Chart_Data", 100.0, true);

    grab.setChartData("Chart_Data", 200.0, false);

    grab.setChartData("Chart_Data", 300.0, false);

    grab.setChartData("Chart_Label", "2013", true);

    grab.setChartData("Chart_Label", "2014", false);

    grab.setChartData("Chart_Label", "2015", false);

    getChartData

    Description

    Returns the value of the ChartData with the given ChartDataName. If more than one ChartData with that name exists a specific one can be chosen using the given index parameter. If no ChartData with the given name exists an empty string is returned.

    Parameters

    ChartDataName : String

    [index : Number]

    Returns

    String

    Example

    Retrieves the value of the second array of Chart_Data:

    grab.getChartData('Chart_Data', 1);

    getChartDataCount

    Description

    Returns the number of items in the ChartData array with the given ChartDataName. If the ChartData does not exist the method returns 0 (zero).

    Parameters

    ChartDataName : String

    Returns

    Number

    Example

    var count = grab.getChartDataCount("Chart_Data");

    var i;

    for (i = 0; i < count; i++)

    {

    grab.setChartData("Chart_Data_2",grab.getChartData("Chart_Data", i), false);

    }

    deleteChartData

    Description

    Removes all ChartData with the given ChartDataName.

    Parameters

    ChartDataName : String

    Returns

    None

    Example

    grab.deleteChartData(“MyChartData”);

    InputRearrange

    Description

    For each input rearrange and insert text with a name, Lasernet creates an array of InputRearrange objects. The array can be accessed using the object name set in the input rearrange dialog. Rearranges without a name are not accessible from script. This array principle makes it possible to make short scripts like Sum(MyRearrange). Objects of type InputRearrange are only available in the Form Engine.

    Properties

    bold

    Description

    Gets and sets the bold property of the font used for rendering the rearrange.

    Access

    Read, Write

    Returns

    Boolean

    Example

    myrearrange.bold = true;

    color

    Description

    Gets and sets the color property of the font used for rendering the rearrange.

    Access

    Read, Write

    Returns

    Color

    Example

    var mycolor = new Color();

    mycolor.setRgb(0x00ff00); // one way to set color to green

    myrearrange.color = mycolor;

    family

    Description

    Gets and sets the font name used for rendering the rearrange.

    Access

    Read, Write

    Returns

    String

    Example

    myrearrange.family = "Courier New";

    italic

    Description

    Gets and sets the italic property of the font used for rendering the rearrange.

    Access

    Read, Write

    Returns

    Boolean

    Example

    myrearrange.italic = true;

    name

    Description

    Returns the object name for the rearrange as set in Lasernet Form Editor.

    Access

    Read

    Returns

    String

    Example

    logger.logEvent(0,’Name of Current Rearrange = ‘+CurrentRearrange.name);

    number

    Description

    Returns the value of the rearrange as a number. The number is parsed from the original text using the settings for input number formats. If a number cannot be parsed 0 (zero) is returned.

    Access

    Read

    Returns

    Number

    Example

    If (myRearrange.number == 0) return ‘Empty’;

    page

    Description

    Always returns 0 (zero).

    Access

    Read

    Returns

    String

    Example

    pointSize

    Description

    Gets and sets the pointSize property of the font used for rendering the rearrange.

    Access

    Read, Write

    Returns

    Number

    Example

    myrearrange.pointSize = 12;

    strikeOut

    Description

    Gets and sets the strike out property of the font used for rendering the rearrange.

    Access

    Read, Write

    Returns

    Boolean

    Example

    myrearrange.strikeOut = false;

    text

    Description

    Returns the original text for the rearrange – that is, before it has been changed by any scripts or other means. The text is not trimmed even if this has been selected in the Designer. The text is exactly as it appears in the left side grab.

    Access

    Read

    Returns

    String

    Example

    myrearrange.family = "Courier New";

    type

    Description

    Returns the type of the rearrange. Currently always returns Text.

    Access

    Read

    Returns

    String

    Example

    myrearrange.family = "Courier New";

    underline

    Description

    Gets and sets the underline property of the font used for rendering the rearrange.

    Access

    Read, Write

    Returns

    Boolean

    Example

    myrearrange.underline = true;

    value

    Description

    Returns the value of the rearrange, for example, after a script has manipulated the value. Be aware that calling the .value property on a rearrange with a script on it may result in an infinite loop if that script directly or indirectly refers to itself!

    Access

    Read

    Returns

    String

    Example

    myrearrange.family = "Courier New";

    weight

    Description

    Access

    Read, Write

    Returns

    Number

    Example

    orientation

    Description

    Access

    Read, Write

    Returns

    Number

    Example

    OutputRearrange

    Description

    For each output rearrange and insert text with a name, Lasernet creates an array of OutputRearrange objects. The array can be accessed using the object name set in the output rearrange dialog. Rearranges without an object name are not accessible from script. This array principle makes it possible to set properties for an output rearrange. Objects of type OutputRearrange are only available in the Form Engine.

    Properties

    backgroundColor

    Description

    Gets and sets the background color property of the font used for rendering the rearrange.

    Access

    Read, Write

    Returns

    Boolean

    Example

    myoutputrearrange.backgroundColor = 0x00ff00; // one way to set color to green;

    borderColor

    Description

    Gets and sets the border color property of the font used for rendering the rearrange.

    Access

    Read, Write

    Returns

    Color

    Example

    myoutputrearrange.borderColor  = 0xff0000; // one way to set color to red;

    borderWidth

    Description

    Gets and sets the border width in points used for rendering the rearrange.

    Access

    Read, Write

    Returns

    String

    Example

    myoutputrearrange.borderWidth = 10;

    marginSize

    Description

    Gets and sets the margin size in millimeters used for rendering the rearrange.

    Access

    Read, Write

    Returns

    Boolean

    Example

    myoutputrearrange.marginSize = 100;

    Sheet

    The Sheet class is used in the Form Engine to access the sheet currently being processed. The Sheet class is automatically instantiated in the sheet object. The Sheet class cannot be instantiated from script.

    Properties

    evaluate

    Description

    On a Sheet Start Modifier this property can be set to false to stop evaluating/analyzing the sheet. No processing will be done for the sheet and nothing will be printed for the sheet. Only Sheet Start modifiers will be run for that sheet.

    The usual criteria based on JobInfos can be used to determine whether to run the modifier and thereby hinder the evaluation of the sheet.

    Access

    Read, Write

    Returns

    Boolean

    Example

    sheet.evaluate = false;

    name

    Description

    Returns the name of the sheet as set in the Form Designer.

    Access

    Read

    Returns

    String

    Example

    logger.logEvent(0, 'Name of the sheet = ' + sheet.name);

    type

    Description

    Always returns the value ‘Sheet’.

    Access

    Read

    Returns

    String

    regionalProfile

    Description

    Returns and sets the name of the associated regional profile, which is used for rendering output. If there is no regional profile with the name chosen, the output rendering will fail with an error and no output will be shown for the affected rearranges.

    Note: Value can only be read if it is set/written by the script. Value cannot be read if set from the interface after introducing the list of values with criteria.

    Access

    Read, Write

    Returns

    String

    Example

    sheet.regionalProfile = "Default";

    Functions

    fontStyle

    Description

    Returns a new FontStyle object, which allows you to manipulate with the parameters of the selected style name (for more information see Chapter 4.6.3 FontStyle).

    Parameters

    StyleName :String

    Access

    Read

    Returns

    FontStyle

    Example

    var basicFont = sheet.fontStyle("Basic");

    shapeStyle

    Description

    Returns a new ShapeStyle object, which allows you to manipulate with the parameters of the selected style name (for more information see Chapter 4.6.4 ShapeStyle).

    Parameters

    StyleName :String

    Access

    Read

    Returns

    ShapeStyle

    Example

    var basicShape = sheet.shapeStyle("Basic");

    Form

    The Form class is used in the Form Engine to access the form currently being processed. The Form class is automatically instantiated in the form object. The Form class cannot be instantiated from script.

    Properties

    name

    Description

    Returns the name of the form as set in the Form Designer.

    Access

    Read

    Returns

    String

    Example

    logger.logEvent(0, 'Name of the sheet = ' + form.name);

    type

    Description

    Always returns the value ‘Form’.

    Access

    Read

    Returns

    String

    Example

    regionalProfile

    Description

    Returns and sets the name of the associated regional profile, which is used for parsing input. If there is no regional profile with the name chosen, the input parsing will fail with an error for the affected rearranges.

    Note: Value can only be read if it is set/written by the script. Value cannot be read if set from the interface after introducing the list of values with criteria.

    Access

    Read, Write

    Returns

    String

    Example

    form.regionalProfile = "Default";

    Functions

    fontStyle

    Description

    Returns a new FontStyle object, which allows you to manipulate with the parameters of the selected style name (for more information see Chapter 4.6.3 FontStyle).

    Parameters

    StyleName :String

    Access

    Read

    Returns

    FontStyle

    Example

    var basicFont = form.fontStyle("Basic");

    shapeStyle

    Description

    Returns a new ShapeStyle object, which allows you to manipulate with the parameters of the selected style name (for more information see Chapter 4.6.4 ShapeStyle).

    Parameters

    StyleName :String

    Access

    Read

    Returns

    ShapeStyle

    Example

    var basicShape = form.shapeStyle("Basic");