> Task 7: | Format the report

> Now that you verified that the report displays the correct data in the correct order, you can turn your attention to improving the report’s appearance. You perform the following tasks in this section:

> n | Edit the text of the column headings.

> n | Format the column headings to differentiate them from the data rows.

> n | Display the contact first and last names on the same line.

> n | Increase the space between rows.

> #### Edit the column headings

> 1 | Choose Layout to return to the layout editor.

> 2 | Double-click the first column heading, CUSTOMERNAME. The column heading is in the first row—the header row—of the table.

> 3 | To replace all the highlighted text, start typing, then press Enter when you finish. To edit the text, click once to deselect the text, then position the cursor where you want to add or delete characters.

> Replace CUSTOMERNAME with the following text:
> Customer

> 4 | Repeat steps 2 and 3 to change the second and third column headings to the following text:

> Phone
> Contact
> The report design should look like the one shown in Figure 1‑23.

> Figure 1-23 | Revised column headings in a report design

> #### Format the column headings

> To format a report element, you set its properties. You can accomplish this task in one of the following two ways:

> n | Set an element’s properties through Property Editor.

> n | Define a style that contains the desired properties, and apply the style to an element. Use this method to define format properties once and apply them to more than one element.

> In this procedure, you use the first method to set the column headings to bold, and the second method to add color to the header row.

> 1 | To set the column headings to bold using Property Editor:

> 1 | Select all the column headings. To select multiple elements, press the Shift key as you click each element. Property Editor displays the properties for the selected elements, as shown in Figure 1‑24.

> Figure 1-24 | Properties for selected elements in Property Editor

> 2 | Choose B to format the column headings as bold text.

> 3 | To deselect the column headings, click the white space outside the table.

> 2 | To add a background color to the header row, using a style:

> 1 | From the main menu bar, choose Element->Style->New Style.

> New Style appears, as shown in Figure 1‑25. The left side displays the property categories. The right side displays the properties for the category that you select.

> Figure 1-25 | New Style

> 2 | For Custom Style, specify the following name for the style:

> table_header_row

> 3 | Choose Background from the list of property categories. New Style displays the background properties that you can set.

> 4 | Specify a color for the Background Color property, using one of the following methods:

> o | Select the button next to the property, then select a color from the color palette that appears.

> o | Select a color from the drop-down list.

> Choose OK.

> 5 | In the layout editor, select the table by selecting the Table tab in the lower left corner. This tab appears when you hover the mouse pointer over the lower left corner of the table. Clicking the table causes guide cells to appear at the top and left side of the table, as shown in Figure 1‑26.

> Figure 1-26 | Guide cells at top and left of a table

> 6 | Select the guide cell next to the header row. Property Editor displays the properties for the selected row.

> 7 | Choose Properties then General to display the general properties for the row.

> 8 | Apply the style that you just created by selecting table_header_row from the drop-down list next to Style. BIRT Report Designer applies the style to the header row and it appears in color.

> 3 | Preview the report. The report should look like the one shown in Figure 1‑27.

> Figure 1-27 | Report preview showing header row style

> So far, the main improvement is that the headings are clearly visible and defined.

> #### Display first and last names on the same line

> When you place multiple elements in a single cell, BIRT Report Designer creates block-level elements. If you are familiar with HTML, you know that each block element starts on a new line. To display multiple elements on the same line, you need to set them as inline elements. Alternatively, you can concatenate the first and last name values to display in a single data element, as described in this procedure.

> 1 | Choose Layout to return to the layout editor.

> 2 | Delete the data element that displays [CONTACTLASTNAME].

> 3 | Double-click the data element that displays [CONTACTFIRSTNAME].

> Edit Data Binding, shown in Figure 1‑28, shows information about the data associated with the current data element. In Expression, dataSetRow["CONTACTFIRSTNAME"] indicates that the data element displays data from the CONTACTFIRSTNAME field in the data set.

> Figure 1-28 | Edit Data Binding

> 4 | Click the expression builder button next to dataSetRow["CONTACTFIRSTNAME"].

> The expression builder displays the expression in the text area at the top of the window.

> 5 | To concatenate the first and last names, edit the expression as follows:

> dataSetRow["CONTACTFIRSTNAME"]+" "+ dataSetRow["CONTACTLASTNAME"]
> Figure 1‑29 shows this expression in the expression builder. The empty quotation marks (" ") add a space between the first name and last name. You can type the expression in the text area, as shown in Figure 1‑29, or double-click an item in the lower right of the window to insert it in the expression. Figure 1‑30 shows a column name that you can double-click to insert into the expression.

> Figure 1-29 | Concatenated data in the expression builder

> Figure 1-30 | Concatenated data in the expression builder, created by choosing a data set field

> 6 | Choose OK to close the expression builder.

> The edited expression appears in Edit Data Binding. Choose OK to save the changes to the data element.

> 7 | Preview the report. The report should look like the one shown in Figure 1‑31.

> Figure 1-31 | Report preview showing concatenated contact names

> #### Increase the space between rows

> The default layout adds a minimum space between table rows. Typically, you will want to adjust the spacing between rows.

> 1 | Choose Layout to return to the layout editor.

> 2 | Select the table’s detail row, the middle row, as shown in Figure 1‑32.

> Figure 1-32 | Selected table row in the layout editor

> Property Editor displays the properties for the row. The title that appears in Property Editor shows the type of element that you select, so you should see Property Editor—Row.

> 3 | In the General properties, set Height to 24 points. The height of the row increases, as shown in Figure 1‑33.

> Figure 1-33 | Row height set to 24 points

> 4 | Preview the report. The report should look like the one shown in Figure 1‑34. There is more space between the rows of data.

> Figure 1-34 | Report preview showing row spacing

(c) Copyright Actuate Corporation 2008