Contingut

# Constructor d'informes

The Report Builder is a tool to create your own database reports. Unlike with the Report Wizard, using the Report Builder you can take control to design the report the way you want. The generated report is a Writer document that you can edit, too.

To use the Report Builder, the Java Runtime Environment (JRE) software must be installed, and this software must be selected in LibreOfficeDev.

## Per a instal·lar el programari JRE

El Constructor d'informes requereix que un entorn d'execució del Java (JRE) estigui instal·lat.

1. Choose LibreOfficeDev - PreferencesTools - Options - LibreOfficeDev - Advanced.

2. Espereu un minut, mentre el LibreOfficeDev recull informació sobre el programari Java instal·lat al vostre sistema.

   Si es troba una versió recent de JRE al vostre sistema, veureu una entrada a la llista.

3. Click the option button in front of the entry to enable this JRE version for use in LibreOfficeDev.

4. Ensure that Use a Java runtime environment is enabled.

If no JRE version is found on your system, open your web browser and download the JRE software from http://www.java.com. Install the JRE software. Then restart LibreOfficeDev and open LibreOfficeDev - PreferencesTools - Options - LibreOfficeDev - Advanced again.

## To open the Report Builder

1. Open a Base file or create a new database. The database must contain at least one table with at least one data field and a primary key field.

2. Click the Reports icon in the Base window, then choose Create Report in Design View.

   S'obre la finestra del Constructor d'informes.

El Constructor d'informes està dividit en tres parts. A dalt, es visualitza el menú i, a sota, les barres d'eines.

A la dreta, es visualitza la finestra Propietats, amb els valors de propietat de l'objecte actualment seleccionat.

La part esquerra de la finestra del Constructor d'informes mostra la vista Constructor d'informes. La vista Constructor d'informes està inicialment dividida en les tres zones següents (de dalt a baix):

1. Page Header - drag control fields with fixed text into the Page Header area

2. Detail - drag and drop database fields into the Detail area

3. Page Footer - drag control fields with fixed text into the Page Footer area

To insert an additional Report Header and Report Footer area choose Edit - Insert Report Header/Footer. These areas contain text that appears at the start and end of the whole report.

Feu clic a la icona «−» davant del nom d'una àrea per a col·lapsar-la i reduir-la a una sola línia a la vista del Constructor d'informes. La icona «−» canvia a una icona «+», i podeu fer-hi clic per a tornar a desplegar l'àrea.

You insert database fields by drag-and-drop into the Detail area. See the section "To insert fields into the report" below.

In addition, you can click the Label Field or Text Box icon in the toolbar, then drag a rectangle in the Page Header or Page Footer area, to define a text that is the same on all pages. You enter the text in the Label box of the corresponding Properties window. You can also add graphics by using the Graphics icon.

## Per a connectar l'informe a una taula de base de dades

1. Moveu el ratolí a la vista Propietats. Es visualitzen dues pestanyes: General i Dades.

2. A la pestanya Dades, feu clic a Contingut per a obrir el quadre combinat.

3. Seleccioneu la taula per a la qual voleu crear l'informe.

4. After selecting the table, press the Tab key to leave the Content box.

La finestra Afegeix camps a l'informe s'obre automàticament i mostra tots els camps de la taula seleccionada.

## Afegir camps a l'informe

La finestra Afegeix un camp ajuda a inserir les entrades de la taula a l'informe.

Després d'inserir camps a la vista Detall, l'informe està preparat per a l'execució.

## Per a executar un informe

Feu clic a la icona Executa l'informe a la barra d'eines.

Icona Executa l'informe

S'obre un document del Writer i es mostra l'informe que heu creat, que conté tots els valors de la taula de base de dades que heu inserit.

Si el contingut de la base de dades ha canviat, executeu de nou l'informe per a actualitzar l'informe de resultats.

## Per a editar un informe

First decide if you want to edit the generated report, which is a static Writer document, or if you want to edit the Report Builder view and then generate a new report based on the new design.

The Writer document is opened read-only. To edit the Writer document, click Edit Document on the information bar, or choose Edit - Edit Mode.

If you want to edit the Report Builder view, you can change some of its properties.

Click in the Details area. Then in the Properties window, change some properties, for example the background color.

After finishing, click the Execute Report icon to create a new report.

Icona Executa l'informe

If you close the Report Builder, you will be asked if the report should be saved. Click Yes, give the report a name, and click OK.

## Ordenació de l'informe

Without sorting or grouping, the records will be inserted into the report in the order in which they are retrieved from the database.

1. Open the Report Builder view and click the Sorting and Grouping icon on the toolbar. You see the Sorting and Grouping dialog.

Icon Sort and Grouping

2. In the Groups box, click the field which you want as the first sort field, and set the Sorting property.

3. Executeu l'informe.

## Agrupament

1. Open the Report Builder view and click the Sorting and Grouping icon on the toolbar. You see the Sorting and Grouping dialog.

2. In the Groups box, open the Group Header list box and select to show a group header.

3. Click the Add Field icon to open the Add Field window.

Icon Add Field

4. Drag-and-drop the field entry that you want to group into the group header section. Then drag-and-drop the remaining fields into the Detail section.

5. Execute the report. The report shows the grouped records.

If you like to sort and group, open the Report Builder view, then open the Sorting and Grouping dialog. Select to show a Group Header for the fields that you want to group, and select to hide the Group Header for the fields that you want to be sorted. Close the Sorting and Grouping window and execute the report.

## Updating and printing your data

When you insert some new data or edit data in the table, a new report will show the updated data.

Click the Reports icon and double-click your last saved report. A new Writer document will be created which shows the new data.

Icon Reports

Per a imprimir un informe, trieu Fitxer ▸ Imprimeix al document del Writer.

Ens cal la vostra ajuda!