How can multiple built-in report styles be added?

Is there an example of a Report with 2 built-in styles from which to select?

The built-in Detailed Descendant Report and addon Detailed Descendant Book text reports have a built-in ‘default’ style. With some changes added in the style editor, it can be made (somewhat) closer to the format used by the New England Historical & Genealogical Register.

Is there an example of how both the default and that NEHGR style variant can be hard-coded in the styles?

There is an example of making a default style:

When I create another Style, it is saved in an .xml format file that is ID’s with the Report name… like an .ini file. That isolates it from the other Reports. (In this case, the addon is a derivative of a built-in. But the style created for the addon isn’t reusable with the built-in.) This also means the file isn’t editable in any of the wysiwyg CSS editing tools.

I was expecting that styles would be saved in .css format in the CSS folder of the Gramps User Directory. Instead the det_descendant_report.xml file was in the top level of directory.

<stylelist>
<sheet name="NGSQ draft">
<style name="DDR-ChildList">
<font face="1" size="12" italic="0" bold="0" underline="0" color="#000000"/>
<para description="The style used for the text related to the children." rmargin="0.000" lmargin="2.250" first="-0.750" tmargin="0.000" bmargin="0.000" pad="0.000" bgcolor="#ffffff" level="0" align="1" tborder="0" lborder="0" rborder="0" bborder="0"/>
</style>
<style name="DDR-ChildTitle">
<font face="1" size="12" italic="0" bold="0" underline="0" color="#000000"/>
<para description="The style used for the children list title." rmargin="0.000" lmargin="1.500" first="0.000" tmargin="0.000" bmargin="0.000" pad="0.000" bgcolor="#ffffff" level="0" align="1" tborder="0" lborder="0" rborder="0" bborder="0"/>
</style>
<style name="DDR-Entry">
<font face="1" size="12" italic="0" bold="0" underline="0" color="#000000"/>
<para description="The basic style used for the text display." rmargin="0.000" lmargin="1.500" first="0.000" tmargin="0.120" bmargin="0.120" pad="0.000" bgcolor="#ffffff" level="0" align="1" tborder="0" lborder="0" rborder="0" bborder="0"/>
</style>
<style name="DDR-First-Entry">
<font face="1" size="12" italic="0" bold="0" underline="0" color="#000000"/>
<para description="The style used for first level headings." rmargin="0.000" lmargin="1.500" first="-1.500" tmargin="0.120" bmargin="0.120" pad="0.000" bgcolor="#ffffff" level="0" align="1" tborder="0" lborder="0" rborder="0" bborder="0"/>
</style>
<style name="DDR-Generation">
<font face="1" size="14" italic="1" bold="0" underline="0" color="#000000"/>
<para description="The style used for the generation header." rmargin="0.000" lmargin="0.000" first="0.000" tmargin="0.250" bmargin="0.250" pad="0.000" bgcolor="#ffffff" level="2" align="0" tborder="0" lborder="0" rborder="0" bborder="0"/>
</style>
<style name="DDR-MoreDetails">
<font face="1" size="12" italic="0" bold="0" underline="0" color="#000000"/>
<para description="The style used for details." rmargin="0.000" lmargin="1.500" first="0.000" tmargin="0.250" bmargin="0.250" pad="0.000" bgcolor="#ffffff" level="0" align="1" tborder="0" lborder="0" rborder="0" bborder="0"/>
</style>
<style name="DDR-MoreHeader">
<font face="1" size="12" italic="0" bold="1" underline="0" color="#000000"/>
<para description="The style used for second level headings." rmargin="0.000" lmargin="1.500" first="0.000" tmargin="0.250" bmargin="0.250" pad="0.000" bgcolor="#ffffff" level="0" align="1" tborder="0" lborder="0" rborder="0" bborder="0"/>
</style>
<style name="DDR-NoteHeader">
<font face="1" size="12" italic="0" bold="1" underline="0" color="#000000"/>
<para description="The style used for the note header." rmargin="0.000" lmargin="1.500" first="0.000" tmargin="0.250" bmargin="0.250" pad="0.000" bgcolor="#ffffff" level="0" align="1" tborder="0" lborder="0" rborder="0" bborder="0"/>
</style>
<style name="DDR-Title">
<font face="1" size="16" italic="0" bold="1" underline="0" color="#000000"/>
<para description="The style used for the title." rmargin="0.000" lmargin="0.000" first="0.000" tmargin="0.250" bmargin="0.250" pad="0.000" bgcolor="#ffffff" level="1" align="0" tborder="0" lborder="0" rborder="0" bborder="0"/>
</style>
<style name="Endnotes-Header">
<font face="1" size="14" italic="1" bold="0" underline="0" color="#000000"/>
<para description="The style used for the generation header." rmargin="0.000" lmargin="0.000" first="0.000" tmargin="0.200" bmargin="0.200" pad="0.000" bgcolor="#ffffff" level="2" align="1" tborder="0" lborder="0" rborder="0" bborder="0"/>
</style>
<style name="Endnotes-Ref">
<font face="1" size="12" italic="0" bold="0" underline="0" color="#000000"/>
<para description="The basic style used for the endnotes reference display." rmargin="0.000" lmargin="1.900" first="-0.900" tmargin="0.200" bmargin="0.000" pad="0.000" bgcolor="#ffffff" level="0" align="1" tborder="0" lborder="0" rborder="0" bborder="0"/>
</style>
<style name="Endnotes-Ref-Notes">
<font face="1" size="12" italic="0" bold="0" underline="0" color="#000000"/>
<para description="The basic style used for the endnotes reference notes display." rmargin="0.000" lmargin="1.900" first="0.000" tmargin="0.200" bmargin="0.000" pad="0.000" bgcolor="#ffffff" level="0" align="1" tborder="0" lborder="0" rborder="0" bborder="0"/>
</style>
<style name="Endnotes-Source">
<font face="1" size="12" italic="0" bold="0" underline="0" color="#000000"/>
<para description="The basic style used for the endnotes source display." rmargin="0.000" lmargin="0.750" first="-0.750" tmargin="0.200" bmargin="0.000" pad="0.000" bgcolor="#ffffff" level="0" align="1" tborder="0" lborder="0" rborder="0" bborder="0"/>
</style>
<style name="Endnotes-Source-Notes">
<font face="1" size="12" italic="0" bold="0" underline="0" color="#000000"/>
<para description="The basic style used for the endnotes notes display." rmargin="0.000" lmargin="0.750" first="0.000" tmargin="0.200" bmargin="0.000" pad="0.000" bgcolor="#ffffff" level="0" align="1" tborder="0" lborder="0" rborder="0" bborder="0"/>
</style>
</sheet>
</stylelist>

I did a little test.

I created a second style in the code

Copied def make_default_style(self, default_style): section and renamed the second style NEHGR_style

Relaunched Gramps but the second style did not get added to the style list.

So, each report can have only one hard coded style format.


Users can create their own style for the report. The user styles are saved in an xml file with the report’s name. An unlimited number of report styles can be created and stored in the report’s XML file.

So, you can create the NEHGR style for the report for your use. To share? you would only be able to share the XML code. Note, I already had two styles in my det_descendant_report.xml. I could not drop your XML into my folder without losing my existing modifications.

So I see two options.

  1. Start some type of repository where users can share these types of modifications.

  2. Create a duplicate report Descendant Book NEHGR Report that hard codes the style into the default_style

I’m working on that approach currently. (Since to completely replicate the NEHGR style, it needs content changes in addition to the style changes. It will grow much uglier before I’m done since the NEHGS has specifications for MS Word compatible styles that are to be used for submitting for publication. No doubt it’ll end up with a different name due to trademark issues.) I’ve resolved a number of error reports but have more to go. The latest errors are pointing at the style that was simply changed from True to False but is now reporting an ‘indent’ error.

But this error-prone style editing demonstrates that a true CSS approach would be useful. Imagine generating a report in HTML, wysiwyg editing the grampshtml.css and grampstextdoc.css fields that are automatically generated with that output, and then feeding that back into the available stylesheets for the report writing plugin.

It could greatly speed the evolution of report layout design.

Descendant Book NEHGR style Report

I doubt we will be able to use “NEHGR

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.