Mastering EA Document Style Sheets
by Phil Chudley
In order to provide a consistent look-and-feel to documents (RTF/DOCX/PDF) produced from Sparx Systems Enterprise Architect, Sparx Systems provided the facility of a Style sheet so that when applied, the styles defined in the style sheet override the corresponding styles used within the document template(s).
A style sheet is selected when a document is to be generated using either:
- An artefact selected in the Project Browser such as a package.
- A Master Document.
The main challenge faced by EA users is the creation of the style sheet, this tutorial provides you with the techniques for the creation and use of a style sheet.
Overview of the Process
The diagram below illustrates the steps involved in the creation of a style sheet.
This tutorial focuses on the task of creating a new Style Sheet.
Generating a Document without a Style Sheet
For the purposes of this tutorial I will use a simple example of a single Document Template which:
- Outputs a Package Name as a heading.
- Outputs the Diagram(s) contained within that Package.
- Outputs some selected data for each Element containing in the same Package as the diagram. These data items will be placed in a table.
- Outputs some plain text.
- Outputs a list of Realized Requirements for each element.
It is assumed that the reader of this tutorial is familiar with the techniques for creating such a Document Template, but for reference the Template as shown in the Template Editor is shown below:
This template was created using the following styles:
|Template Content||Style Used|
|Table (first column)||Table Heading|
|Table (second column)||Table Text Normal|
It is recommended to make a note of the styles used in your Document Template.
The illustration below shows an extract of the report generated when using this template and the following options on the Documentation Generation dialog:
Creating a Style Sheet
I now describe the process for creating a style sheet that will provide new definition for all the styles listed in the table above.
You have two choices when creating you own style sheet:
- Copy and modify a Sparx Systems supplied style sheet.
- Create a new style sheet from scratch.
This tutorial shows you how to create a style sheet from scratch, but the same process can be used when modifying a copying a Sparx Systems style sheet.
- Using the Resources view, right-click in the User Template section and select Create New Template.
- Complete the dialog as shown in the example below:
- Click OK and the Template Editor will open.
- Right-click in the text area of the Template Editor and select Edit > Edit Style… from the menu:
- Select the first style you wish to change, for example, Heading 2 from the list labelled Select a style to edit.
- Leave the radio button labelled Paragraph Style selected.
- Click OK. This closes the dialog and starts a “style recorder”.
- Using the Style Toolbar in the Template Editor:
- Select the corresponding style in the first drop down list.
- Select you font, size, colour, alignment etc.
- When you have finished click anywhere in the Template Editor to see your changes applied add some text, as shown below (Calibri Font, size 14, Bold, Colour Blue, Numbered) :
- Repeat the process above for all your other styles, and your style sheet should look similar to that below (depending upon what styles you chose during the edit styles process:
- Notice for the Table Heading, I have set the Cell Colour so as to provide a preview of how tables will appear in my documents.
- Save your Style Sheet Template.
Using your New Style Sheet
Now, update your template to set any table cell colour, cell borders and regenerate your document, but this time select the style sheet you just created:
Below is shown the results of applying your style sheet:
This short tutorial has provided you with a fool-proof method of creating a Style Sheet in EA so that your generated documents will have a consistent look a feel.
|Mastering EA Document Style Sheets|