Author Topic: RTF Template heading styles with heading numerical prefix  (Read 138 times)

BruceTOGAF2

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
RTF Template heading styles with heading numerical prefix
« on: January 08, 2018, 11:00:43 pm »
My Jscript identifies the level of each package in a package hierarchy. My Jscript reports the name of the package, specifying which RTF Template Fragment (e.g. 'logfs_head_level_1') to use according to hierarchy level.

var pkgRtfTemplate = pkgNameRtfTemplate(level);
docGenerator.DocumentPackage( parentPackage.PackageID, 0, pkgRtfTemplate);

The following text demonstrates the heading level error in my RTF export from Sparx.

1  I am Heading Level 1. I am functioning correctly
2  I am Heading Level 1. I am functioning correctly
3  I am Heading Level 1. I am functioning correctly
   3.1  I am Heading Level 2. I am functioning correctly
   3.2  I am Heading Level 2. I am functioning correctly
      3.2.1  I am Heading Level 3. I am functioning correctly      
         3.2.1.1  I am Heading Level 4. I am functioning correctly
         3.2.1.2  I am Heading Level 4. I am functioning correctly         
            3.1.1.1.37  I am Heading Level 5. I am malfunctioning
            3.1.1.1.38  I am Heading Level 5. I am malfunctioning


My RTF Template Fragments 'logfs_head_level_1', 'logfs_head_level_2' etc print the package name within a heading style.
Heading Levels 1 to 4 use RTF Template Fragments that contain styles available in the drop-down list of the RTF Template editor.
For example, Heading Level 4 uses 'heading 4, H4,h4, ...' from the drop-down list of the RTF Template editor.

The problem starts when I use my RTF Template Fragment 'logfs_head_level_5' that I have created to report Heading Level 5. 
The drop-down list of the RTF Template editor does not offer 'heading 5, H5, ...'.
I copied a Heading Level 5 from a Word document and pasted it into my RTF Template Fragment that I have created to report Heading Level 5.
The result is 5 parts to the heading (e.g. 3.1.1.1.38), but the parent heading number is ignored.

There are multiple sets of heading styles in the drop-down list of the RTF Template editor.

I then amended RTF Template Fragment 'logfs_head_level_5' to style 'Heading 5' within "Heading 1, Heading 2, Heading 3, Heading 4, Heading 5, etc".
The result is still 5 parts to the heading (e.g. 3.1.1.1.38), but the parent heading number is still being ignored.

Instead of using "heading 1, H1,h1, ...,heading 2, H2,h2, ...,heading 3, H3,h3, ...", I tried using "Heading 1, Heading 2, etc" for all Fragments 'logfs_head_level_1', 'logfs_head_level_2' etc.

The problem with this approach is that styles "Heading 1, Heading 2, etc" do not print the heading numerical prefix.

How can I edit styles "Heading 1, Heading 2, etc" so that they print the heading numerical prefix?


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7861
  • Karma: +173/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: RTF Template heading styles with heading numerical prefix
« Reply #1 on: January 09, 2018, 01:23:27 am »
I've managed to get headings 1 to 9 working consistently in my stylesheet.
The trick is to have them all use the same list override for all heading styles.
You can download a sample model containing the stylesheet from my website: https://bellekens.com/2015/11/12/tutorial-generate-complex-documents-from-enterprise-architect-with-a-two-step-semi-automated-approach/

Geert