Chapter 4. Visual Report Items

The previous chapter looked at the BIRT workspace. One should be familiar with the environment he/she will use to build BIRT reports. This chapter will take a look at each of the individual BIRT report elements, some of their uses, and some of their common properties. By gaining some familiarity with these components, we can save ourselves a fair amount of headache while working with BIRT. A surprising number of questions come up while performing some of the more common functions using BIRT components such as how to format numbers as currency or limit decimal places, and how to format dates, along with a few other questions that can be influenced by using simple BIRT properties.

BIRT report components aren't radically different from other visual components used in other visual development environments and report designers. We have some of our more common visual components such as text labels, data bound text elements, and graphics. For those who are already familiar with a web development environment, there are some formatting components that you might already be familiar with such as grids that are similar in function to HTML tables. Then there are some more advanced components such as graphs, tables, cross-tabs, and aggregations.

This chapter will take a look at a number of these components and some of their common uses.

Labels

In almost any development environment, you have static text elements—the elements that won't change for one reason or the other. Common uses of static text elements are as field identifiers in online web forms, identification of what some piece of data is, instruction for how to use an application, on screen prompts, and titles. Reporting is no exception to this rule. In reporting, one can see this type of static text content used as column headers for listings, report titles, and as footer information such as copyright lines. BIRT provides this in the form of Labels. The following is the icon used on the development palette for the Label.

Labels

In the previous chapter, we saw Labels used as the column headers in our employee listing report, although we didn't have to create them explicitly. We got to see one of the properties for Labels when we changed it and made it bold. This illustrated one of the most common properties of the Label component—font information. This will be the most common property to work with when one works with labels, although it is not the only one.

The Label report item is one of the most common and least technical report items to work with. We are going to create a simple report to demonstrate the properties used with this component. Follow the sequence of steps:

  1. Right-click on the Class_Cars_BIRT_Reports project under the Navigator tab and choose New | Report.
    Labels
  2. Make sure the Class_Cars_BIRT_Reports project is highlighted in the New Report dialog box and enter the File name as HelloWorld.rptDesign. Notice that we haven't used a space in the filename. This is because some operating systems have issues with spaces in names and it is considered bad etiquette in others to use spaces even if they are allowed.
    Labels
  3. Select Blank Report from the list of Report templates and click Finish.
    Labels
  4. From the Palette, click on the Label and drag-and-drop it over to the Report Design pane.
    Labels
  5. We will have a blinking cursor on the Label component we just dropped on to the Report Design pane. If we do not have a cursor, double-click on the Label component and type Hello World.
    Labels
  6. Under the Property Editor, the General side tab should be highlighted. If it is not, go ahead and click on it. The General tab is where elements such as the element's name, font selection, font color, alignment, stylesheet selection, and so on are located. Under the Name option, type in lblHello to name the component.
    Labels
  7. Under Font, choose Sans Serif. We can use any font we would like here; I chose Sans Serif because it is a commonly used font for reading text on a computer screen.
  8. Under Size choose 14 points. This will make it easier to read.
  9. Click on the button next to the Color option and select White from the available color options. We want a slightly different contrast than black on white to make it stand out a little.
  10. Click the button next to the Background color option and select the color Black.
  11. Click on the bold button to make the text bold.
  12. Click the Preview tab under Report Designer to see the finished report. The following screenshot shows a finished report:
Labels

We were easily able to manipulate some basic visual elements of the Label component using the Property Editor. There are a number of other elements such as conditional hiding and hyperlinks that will be covered later in more detail. The important thing to remember about the Label is that it is a text component that is not bound to data in any manner.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset