Generating Reports

GRAMPS can produce a wide variety of reports. A new report generator can be written by the user without modifying the main program. For this reason, there may be more reports available than are documented by this manual.

Figure 33. Report Generation Dialog

Unlike many genealogy programs, GRAMPS does not directly print reports. Instead, GRAMPS produces reports in formats that are understood by other programs. These formats include OpenOffice, AbiWord, PDF, and HTML, among others. This allows the generated reports to be modified after they are generated, stored for use at a later time, or e-mailed to another person.

After selecting the report you would like generated there are options you must select. In the Save As option specify your file name (use /full path/filename to specify a different directory than in your Default Report Directory preference in the preferences). The next step is to select the Report Format. After choosing the Format you can select the style you would like to use for your report (this does not apply to the HTML format). You can Add/Edit/Delete a style for that particular report by clicking the Style Editor button. Selecting one of those options you can then change the font (font face, size, color, and options) for each Paragraph Style along with the Paragraph Options (Alignment, background color, margins, and dorders). Once you are satisfied with the style you are ready to proceed with the generation of your report. The next step is to choose the options (if any for that specific report) and then Choose the Template (for HTML format only) and click OK. Your report will now be in default report directory (unless otherwise specified).

Using HTML templates

Many programs exist to convert GEDCOM files into HTML files that can be viewed in a web browser. Most of these programs generate HTML files according to their own predefined style. Since most people have a style that they prefer, they are left with the option of modifying hundreds of files by hand.

To solve this problem, GRAMPS allows the user to specify a template to be used for generating HTML files. At the time the report is generated, if HTML is selected as the target format, the user can select an HTML template to be used. Since the template is chosen at report generation time, a different template may be chosen each time, allowing the user to change the appearance of the generated files at any time. Nearly any existing HTML file can be used as an HTML template for GRAMPS.

When a file has been established as the HTML template file, GRAMPS uses the template for each file that it generates. GRAMPS starts each file by copying data from the template until it reaches the HTML comment, which it uses as a marker. At that point, GRAMPS inserts its data into the output file. GRAMPS the continues reading the until it reaches a second comment that tells it to resume copying from the template.

GRAMPS uses the string <!-- START --> to indicate where it should start inserting its information, and the string <!-- STOP --> to indicate where it should resume copying data from the template. The effect is that GRAMPS will create a new document, replacing everything between the <!-- START --> and <!-- STOP --> comments with the report information.

The comment markers should be at the beginning of a line in the HTML template file. Adding the comments to an existing HTML document will not affect the original HTML document in any way.

If no HTML template is specified, or if the specified template cannot be read, GRAMPS will use a default, predefined template.

<HTML>
<HEAD>
<TITLE>
This is my Title
</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<P>
This is a simple template.  This text will appear in the html output.
</P>
<!-- START -->
<P>
This is where GRAMPS will place its report information. Any 
information between the two comments, including this paragraph,
will not appear in the GRAMPS generated output.
</P>
<!-- STOP -->
<P>
This text, since it appears after the stop comment, will also
appear in every GRAMPS generated file.
</P>
</BODY>
</HTML>
        

Figure 34. Sample HTML Template Example