Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "BIRT/FAQ/Report Layout"

< BIRT‎ | FAQ
(Q: How do I display page numbers in HTML or PDF?)
 
(2 intermediate revisions by 2 users not shown)
Line 8: Line 8:
 
ROM is the model behind the palette items, property dialogs, methods and so on. ROM consists of a set of core elements, and rules for adding extended elements.
 
ROM is the model behind the palette items, property dialogs, methods and so on. ROM consists of a set of core elements, and rules for adding extended elements.
  
Elements can have properties. Properties have a type. Property types include simple ones such a string, number, dimension and so or. Property types also include complex ones such as structures, lists, and lists of structures. For example, static text is defined as a structure with text and a resource key for internationalization.
+
Elements can have properties. Properties have a type. Property types include simple ones such a string, number, dimension and so on. Property types also include complex ones such as structures, lists, and lists of structures. For example, static text is defined as a structure with text and a resource key for internationalization.
  
 
Elements can fit together using "slots". Each element has named slots. For example, the report element has slots for the layout (body), for styles, and so on.
 
Elements can fit together using "slots". Each element has named slots. For example, the report element has slots for the layout (body), for styles, and so on.
Line 47: Line 47:
  
 
=== Q: How do I display page numbers in HTML or PDF? ===
 
=== Q: How do I display page numbers in HTML or PDF? ===
 
+
Select the Master Page tab at the bottom of the Report Editor. This will display the Master Page within the Report Editor. Note that if your report uses multiple Master Pages, a specific Master Page can be selected in the Outline View. Select the Palette view and click on the AutoText folder.  Within this folder several AutoText elements are provided which can be dragged to the Master Page header or footerSeveral of these provide pagination such as Page n of m functionality.
BIRT uses Apache FOP to convert a report to PDF. FOP does pagination and assigns page numbers. As a result, there is no JavaScript expression you can use to get the current page number. Instead, BIRT will add a new "page number" element. It will include a special marker string that tells BIRT or FO where to insert the page number. BIRT will interpret the string when converting to HTML, and will convert the marker to the required FO syntax when converting to PDF using FOP.
+
 
+
The element will allow you to say something like:
+
 
+
  Page $page of $count
+
 
+
At runtime, this will be replaced by:
+
 
+
Page 1 of 5
+
 
+
Release 1.0M2 Note: The page number element has not yet been released. Syntax is still subject to change.
+
  
 
=== Q: How do I display today's Date? ===
 
=== Q: How do I display today's Date? ===
Line 73: Line 62:
  
 
  row[0] + 1;
 
  row[0] + 1;
 
+
==Master Page ==
 +
=== Q: How to remove Date appearing in the Templates provided by BIRT ? ===
 +
Select the preferred template and once the report designer editor opens ... Select the Master Page tab. In this delete the date component from the footer.
 
[[Category:BIRT]]
 
[[Category:BIRT]]
 
[[Category:BIRT FAQ]]
 
[[Category:BIRT FAQ]]

Latest revision as of 01:30, 5 December 2009

< To: BIRT/FAQ

Report Object Model (ROM)

Q: What is the ROM?

ROM stands for "Report Object Model." It is the model (or specification) behind BIRT report elements. Just as HTML, CSS and SOAP are standards separate from an implementation, so ROM is a model separate from the BIRT implementation.

ROM is the model behind the palette items, property dialogs, methods and so on. ROM consists of a set of core elements, and rules for adding extended elements.

Elements can have properties. Properties have a type. Property types include simple ones such a string, number, dimension and so on. Property types also include complex ones such as structures, lists, and lists of structures. For example, static text is defined as a structure with text and a resource key for internationalization.

Elements can fit together using "slots". Each element has named slots. For example, the report element has slots for the layout (body), for styles, and so on.

Elements can have methods & expressions (code). These are specialized forms of properties.

In a later release, elements will be able to inherit from another element. This will allow reuse. For example, you can define a data source in a library, and use it in multiple report designs.

ROM provides styles and style properties. ROM's style system is based on CSS, extended for use within a report. Users can create their own styles, or can use many predefined styles. Predefined styles in ROM select specific report items. For example, the "report" style sets defaults for the entire report. As in CSS, styles cascade. Style information set on a container element cascades to its contents.

To learn more about ROM, read the ROM Specifications located in the reference area of this web site.

Q: What is the XML design file?

BIRT stores your report design in a "design file." This file is in XML format and has a ".rptdesign" suffix. The XML design file is created by the BIRT designer and directly executed by the BIRT engine; there is no compilation step.

Q: What is the ROM schema?

The BIRT XML design file is defined by an XML schema. At present, the schema is located in the BIRT source code in the org.eclipse.birt.report.model project in the src\org\eclipse\birt\report\model\parser\design.xsd file. Eventually, it will move to a well-defined location on the Eclipse web site.

The schema is designed to allow extensions. The schema defines syntax that allows extensions to be added to BIRT without making changes to the actual schema. For example, an extended item uses the following tag:

<extended-item name="extension">

Properties are in a generic form:

<property name="propName">value</property>.

In this sense, the schema describes a syntax for representing report elements in general. The schema does not list the properties, for example; that is defined in a separate rom.def file that is derived from the ROM specification.

Q: What is rom.def?

The ROM schema defines the syntax for the XML design file. The specific set of ROM-defined elements, their slots, and their properties are defined by a separate internal metadata file called rom.def. This file is in the BIRT source code in the org.eclipse.birt.report.model in the src\org\eclipse\birt\report\model\elements\rom.def file.

Rom.def contains the information that drives the generic property sheet by defining properties and property types. It also describes JavaScript objects defined by BIRT and other meta-data.

The metadata subsystem of the BIRT model provides a Java API to access this information. Data Display

Q: How do I display page numbers in HTML or PDF?

Select the Master Page tab at the bottom of the Report Editor. This will display the Master Page within the Report Editor. Note that if your report uses multiple Master Pages, a specific Master Page can be selected in the Outline View. Select the Palette view and click on the AutoText folder. Within this folder several AutoText elements are provided which can be dragged to the Master Page header or footer. Several of these provide pagination such as Page n of m functionality.

Q: How do I display today's Date?

Add a data item. For the expression, enter:

new Date( );

Then, in the Format page of the Property Editor, choose the date format you prefer, such as Medium Date for a display of Apr 15, 2005.

Q: How do I display the row number?

Suppose you want to display a list of items, along with the row number of each. BIRT provides the row variable that gives data for the current data row. row[0] provides the 0-based row index. You can display a 1-based count as follows:

row[0] + 1;

Master Page

Q: How to remove Date appearing in the Templates provided by BIRT ?

Select the preferred template and once the report designer editor opens ... Select the Master Page tab. In this delete the date component from the footer.

Back to the top