The properties of a label are:
| Property Name | Description | Editable | Formula Controllable | Data Type |
|---|---|---|---|---|
| General | ||||
| Class Type | Displays the class type of the object. | N | N | _ |
| Text Format | ||||
| Text | The text of the label. | Y | Y | String |
| Font Face | The font of the label. | Y | Y | String |
| Font Size | The text size of the label. | Y | N | Float |
| Bold | Specifies whether or not to make the label text bold. | Y | Y | Boolean |
| Italic | Specifies whether or not to make the text italic. | Y | Y | Boolean |
| Strikethrough | Specifies whether or not to add a Strikethrough line to the text. | Y | Y | Boolean |
| Underline | Specifies whether or not to underline the text. | Y | Y | Boolean |
| Autofit | Adjusts the width of the label according to the text. Not applicable for render types checkbox, radio button, rank, barcode, image button, and image. | Y | Y | Boolean |
| Maximum Width | Often works with the Autofit property. If Autofit = true, Maximum Width is not equal to 0, the content will extend until the width is this value. | Y | N | Float |
| Word Wrap | Specifies whether or not to wrap the label text to the width. Not applicable for render types checkbox, radio button, rank, barcode, image button, and image. | Y | Y | Boolean |
| Ignore HTML Tag | If this property is set to true, HTML tag elements in the field value will be parsed while the report set is to be saved as an HTML file; or the field value will appear in the HTML file the same as that in JReport Designer (HTML tag elements in the field value, if any, will not be parsed). | Y | Y | Boolean |
| Vertical Alignment | Vertical justification of the text in the label. | Y | N | Integer |
| Horizontal Alignment | Horizontal justification of the text in the label. | Y | N | Integer |
| Geometry | ||||
| X | The horizontal coordinate of the left top corner in the container. | Y | Y | Float |
| Y | The vertical coordinate of the left top corner in the container. | Y | Y | Float |
| Width | The width of the label. | Y | Y | Float |
| Height | The height of the label. | Y | Y | Float |
| Color | ||||
| Background | The background color. | Y | Y | String |
| Foreground | The foreground color. | Y | Y | String |
| CSS | ||||
| Style | Applies a style to the object. | Y | N | String |
| ID | An identifier for the label. It must be unique in the report set. The ID property can be a style sheet selector. | Y | Y | String |
| Class | This property assigns a class name to an object. Any number of objects may be assigned the same class name. On the other hand, assigns one or more class names to an object; the object may be said to belong to these classes. A class name may be shared by several objects. This property only has one role in JReport: as a style sheet selector (when an author wishes to assign style information to a set of objects). | Y | Y | String |
| External CSS Class Selector | Specifies the name of the class selector which will describe the style for the object when exporting the report result in HTML format. | Y | Y | String |
| Excel | ||||
| Column Index | Specifies the X coordinate of the selected object in the exported XLS or CSV file. An object with this property value less than 1 will not be included in the exported XLS or CSV file. If you set the report property Columned to true, Column Index property of an object will be automatically set to a value according to its position in its parent. | Y | N | Integer |
| Row Index | Specifies the Y coordinate of the object in the exported XLS or CSV file. An object with this property value less than 1 will not be included in the exported XLS or CSV file. If you set the report property Columned to true, Row Index property of the object will be automatically set to a value according to its position in its parent. | Y | N | Integer |
| Border | ||||
| Border Thickness | The width of the border. | Y | N | Float |
| Top Line | The line style of the top border. | Y | N | Integer |
| Bottom Line | The line style of the bottom border. | Y | N | Integer |
| Left Line | The line style of the left border. | Y | N | Integer |
| Right Line | The line style of the right border. | Y | N | Integer |
| Shadow | Specifies whether or not to draw a shadow. | Y | Y | Boolean |
| Border Color | The color of the border. | Y | Y | String |
| Shadow Color | The color of the shadow. | Y | Y | String |
| Pattern | ||||
| Pattern Color | Specifies a color to draw the pattern to fill the label. | Y | Y | String |
| Pattern Style | The style of the pattern. | Y | N | Integer |
| Others | ||||
| Position | Indicates how to position the object. | Y | N | Integer |
| Invisible | If true, the object will not be displayed in both design and view modes. | Y | Y | Boolean |
| Suppress | If true, the object will not be displayed in view mode. | Y | Y | Boolean |
| Suppress When No Records | If true and no record returned for the data container, the object will not be displayed in view mode. | Y | Y | Boolean |
| Record Location | Specifies the calculation point for the properties of the object. | Y | N | Integer |
| Export to CSV | If false, the object will not be exported when the report result is to be exported to a CSV file. | Y | Y | Boolean |
| Export to Excel | If false, the label will not be exported when the report result is to be exported to an XLS file. (Make sure that Excel 2000 in the Export to XLS dialog is checked.) | Y | Y | Boolean |
| Link | Contains the link information. | Y | N | String |
| Enable Hyperlink in PDF | Specifies whether or not to contain the hyperlinks when exporting the result to a PDF file. | Y | Y | Boolean |
| Enable Hyperlink in Excel | Specifies whether or not to contain the hyperlinks when exporting the result to an XLS file. | Y | Y | Boolean |
| Enable Hyperlink in HTML | Specifies whether or not to contain the hyperlinks when exporting the result to an HTML file. | Y | Y | Boolean |
| Detail Report | Specifies the detail report that the label is linked to. Not available for labels in a map. | Y | N | String |
| Transfer Style | Specifies whether or not to transfer the component style to the link report if the object is bound with a link to a report. | Y | Y | Boolean |
| Go to Detail | Specifies whether or not to enable the Go-to-detail action on the object. With this action enabled, you can click the object to show the detailed information in JReport Web. | Y | Y | Boolean |
| Link Catalog | Specifies the path and filename of the catalog that the link report belongs to. | Y | Y | String |
| Filter Options | Defines whether the filter-related shortcut menu items will be displayed when a user right-clicks the object in JReport Web. | Y | N | Integer |
| Sortable | Specifies whether or not to use this label to sort the records by the bind column when the report is being viewed in DHTML format. | Y | Y | Boolean |
| Filterable | Specifies whether or not to use this label to control the filter conditions for the report data when the report is being viewed in DHTML format. | Y | Y | Boolean |
| Bind Column | Binds the label with a data field so that the label can be used to control the data filter conditions or record order. | Y | N | String |
| TOC | ||||
| TOC Anchor | Specifies whether or not to add the node that represents this object to the TOC tree. Only applicable for labels in a banded object. | Y | Y | Boolean |
| Anchor Display Value | If TOC Anchor = true, the property value of Anchor Display Value will be displayed on the TOC tree as the text of the node representing the object. Only applicable for labels in a banded object. | Y | Y | String |
Here is a label:
Label product sales by region
We want to show it as:
Label product
sales by region
We can set the following:
Autofit=true enables the contents to grow horizontally but stop when the width becomes 1. Word Wrap=true enables the remaining contents to wrap downward if no space is left horizontally.
This property is useful for exporting the report result in HTML format. You may want to write the label contents in HTML tags in your report, and for the exported HTML file(s), the tags will be transferred as they are translated into HTML.
This property is used for setting the style of the label pattern. It can be:
This property is to specify the calculation point for the properties of the object. Here is an example:
A report specifies to display Continued on Next Page for every page that has another following it. If this label is inserted in the PageHeader/PageFooter, then every page including the last page will contain the message. There is a way to write formulas that can resolve the problem:
Continue1:
global boolean j=true;
j=false;
Continue2:
pagenumber;
j=true;
Continue3:
pagenumber;
return j;
Insert Continue1 into the Report Header, Continue2 into the Report Footer. To track the calculation, you can insert Continue3 into the Page Footer. If you do not want to see these formulas in view mode, you can suppress them.
Insert label Continued on Next Page in the Page Header, and use Continue3 to control its property Invisible.
Set the property Record Location of the above label to be page footer, so that Continue3 returns value which is calculated in the Page Footer instead of in the Page Header.
This property is used to add a link to a label which refers to another report, a detail report, a web site or an e-mail address. Links that you create in a report are available when you view the report in HTML, PDF, or Excel format.
When you view your report in JReport Web, you can sort records in the data buffer on certain DBFields. You are allowed to use a label to control the sorting order, which can be enabled in JReport Designer by the Sortable property of the label object.
When you view your report in JReport Web, you can set a series of conditions and use a DHTML server to filter the data buffer and reproduce the report. You are allowed to use a label to control the filter conditions for the data, which can be enabled in JReport Designer by the Filterable property of the label object.