Jump to content
We've recently updated our Privacy Statement, available here ×
  • Measure Units in Jaspersoft Studio


    morlandin
    • Edited on:
    • Version: v1.3.1 Product: Jaspersoft® Studio

    Introduction

    Jaspersoft® Studio can handle a wide variety of measure units, including pixels, centimeters, millimeters and inches. To accomplish this, we included a measure component in Jaspersoft® Studio. This component looks like a standard text box with a place to enter a measure unit to the right of the value. You can see an example of this widget in the following image:

    1(6).png.15d9406baaf3bd00d16513ac42f8acc3.png

    This component can handle a different measure unit for each field, if needed.


    Configuration

    You can set two preferred (default) measure units, one at the field level, the other at the report level. The report level measure is used wherever there is not a prefered field measure unit. The report's default measure unit is the pixel.

    To change the report level measure:

    1. Select Window > Preferences >Jaspersoft Studio >Report Designer
    2. Find the Default Unit where you can set one of the supported measure units, as shown below:

    2(4).png.3bf91c2632b8a746cd665560593ee4bc.png

    1. Use the drop-down menu to select one of the following measure units:
    • Pixels
    • Inches
    • Millimeters
    • Centimeters
    • Meters

    Changing the Field Measure Unit

    There are two ways to change a specific field's measure units:
    • You can insert a new value with the measure unit you want to use in that field. For example, in the figure below, there is an element with size "496 pixel". By inserting a new value, such as "5 cm", the new measure unit for this field will be switched to centimeter and saved for the current sections. This means that without closing the report and reopening it (or changing it manually)  the measure unit for the width of that element will remain centimeters. If one value is provided without a measure unit it is assumed that it is the default measure of the field, or, if one isn't provided there, the default unit defined at report level. When a value is inserted manually into the field, no spaces are allowed in the numerical value or in the measure unit, but there can be any number of spaces between the value and the unit.
    • You can also change the local measure unit of a field by double clicking on the measure unit. A pop-up menu appears with all the available measure units listed. Select one of them to set the field's preferred measure, as shown in the following image:

    3(1).png.66bfaec16a577d46a409c815badc8bf7.png


    Alias and Autocompletion 

    Jaspersoft® Studio has included alias and autocompletion services for measure units. For instance, if you want to use inches, you can type "inch", "inches", or use quote marks. the table below shows the options for entering measure units:

    Units Accepted Values
    centimeter centimeter, centimeters, cm
    millimeter millimeter, millimeters, mm
    meter meter, meters, m
    pixel pixel, pixels, px
    inch inch, inches, " (double quote)

    In this way, it is simpler to provide a unit, and to help, an autocompletion system is provided. After the value is provided, and the first character of a measure unit is be typed, all the available units that start with that character will be suggested with a popup, and could be selected using the keyboard arrow keys or the mouse, as you can see in the image below:

    4(1).png.a635ae93e78b5668f135ba4c160d29f1.png

    If a typed value, or measure, is not understood, the background of its field will appear red, and the corresponding value or measure will not changed in the report until a correct value is inserted, as you can see in the following image:

    5(1).png.29a40d125c320dce02fbfd5af942787b.png

    For the width, in the figure above,  we have an invalid number (the numerical value can have only digits and dot). The height has "cat" as an invalid measure unit.


    Approximations

    Even if Jaspersoft® Studio handled many measure units, JasperReports works only with pixels. Because of this, pixels is the only measure unit that is allowed in the project file. Jaspersoft® Studio will approximate measurement and convert them to pixels. For example, if you are using centimeters, "5 cm", it will be converted to the nearest pixels value. In this case the 5 centimeters will be converted to 139 pixels (about 4.97 cm)


    User Feedback

    Recommended Comments

    Using TIBCO Jaspersoft® Studio 6.6.0, follow the instrucctions and meassures still displayed in px not in cm.

    i can input the location and size values using "4.5 cm." but they change to px, my report size is specified on cm and the values in px for the location of the elements it's out of the report printable area.

     

     

     

    Link to comment
    Share on other sites



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...