> Task 8: | Format the cross tab

> Now that the cross tab displays the correct data, you can focus on improving the presentation of data in the cross tab. You perform the following tasks in this section:

> n | Display a string in empty cells.

> n | Change the format of the numbers.

> n | Edit the column headings.

> n | Use darker lines around the cross tab and the cells.

> #### Display a string in empty cells

> If there are no sales for a particular product in a particular state, the cell displays nothing. Because an empty cell can be interpreted as missing data, you can display a string, such as 0.00 or --, to indicate that the value is zero.

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

> 2 | Select the cross tab. Select the entire cross tab by clicking on the tab in the lower left corner of the cross tab.

> 3 | In Property Editor, choose the Properties tab, then choose General.

> 4 | In For empty cells, show:, type --, as shown in Figure 17‑17.

> Figure 17 17 | General properties of the cross tab

> 5 | Preview the report. Cells that were previously empty now display --, as shown in Figure 17‑18.

> Figure 17 18 | Preview of the cross tab showing -- to indicate no data

> #### Change the format of the numbers

> To indicate that the numbers displayed in the cross tab are dollar amounts, use the currency format. It is also easier to read the numbers if they are aligned to the right.

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

> 2 | Click in an empty area on the report page.

> 3 | Choose Element->New Style.

> 4 | In Custom Style, type the following name for the new style:

> crosstab_currency

> 5 | Choose Format Number from the list of property categories.

> 6 | In Format As, select Currency from the drop-down list.

> 7 | In Currency Setting, specify the following values:

> 1 | Set Decimal places to 2.

> 2 | Select Use 1000s separator.

> 3 | In Symbol, select $.

> 4 | Use the default values for the other currency settings.

> Figure 17‑19 shows the currency values you set.

> Figure 17 19 | Format Number showing the currency settings

> 8 | Choose Text Block from the list of property categories.

> 9 | In Text alignment, select Right, as shown in Figure 17‑20.

> Figure 17 20 | Text Block showing the change in text alignment

> 10 | Choose OK to save the crosstab_currency style.

> 11 | In the layout editor, select the four [EXTENDED_PRICE] data elements, as shown in Figure 17‑21.

> Figure 17 21 | Data elements selected

> 12 | In General properties of Property Editor, in Style, select crosstab_currency from the drop-down list, as shown in Figure 17‑22.

> Figure 17 22 | Select the crosstab_currency style to apply to the data elements

> 13 | Preview the report to verify the formatting change.

> #### Edit the column headings

> When you insert a summary field, BIRT adds a label that displays the field name as a column heading. In the generated cross tab, the heading EXTENDED_PRICE appears in every column below the product line names. Because the cross tab displays values from one summary field only, the label is not necessary.

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

> 2 | Select the two labels that display EXTENDED_PRICE, as shown in Figure 17‑23. These labels are directly below [PRODUCTLINE] and Grand Total.

> Figure 17 23 | EXTENDED_PRICE labels selected

> 3 | Press Delete.

> 4 | Preview the report. Figure 17‑24 shows a portion of the generated cross tab.

> Figure 17 24 | Preview of the cross tab

> #### Use darker lines around the cross tab and the cells

> BIRT uses two predefined styles, crosstab and crosstab-cell, to set the default appearance of the overall cross tab and the cells, respectively.

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

> 2 | Choose the Outline view.

> 3 | Expand the Styles item to show the crosstab and crosstab-cell styles, as shown in Figure 17‑25.

> Figure 17 25 | Outline view displaying the cross-tab styles

> 4 | Right-click the crosstab style, then choose Edit Style.

> 5 | On Edit Style, choose Border. The colors of the borders are set to Gray.

> 6 | Change the color of all the borders to Black, as shown in Figure 17‑26.

> Figure 17 26 | Border colors set to Black

> 7 | Choose OK to save your change to the crosstab style.

> 8 | In Outline, right-click the crosstab-cell style, then choose Edit Style.

> 9 | Use the same steps to set all the cell border colors to Black, then choose OK.

> In the layout editor, the lines around the cells and around the cross tab appear in black, as shown in Figure 17‑27.

> Figure 17 27 | Cross tab design showing black borders

> 10 | Preview the report. Figure 17‑28 shows a portion of the generated cross tab.

> Figure 17 28 | Preview of the finished cross tab

(c) Copyright Actuate Corporation 2008