Scripted Formatting

Navigation:  Advanced Formatting >

Scripted Formatting

Previous pageReturn to chapter overviewNext page

eaDocX tries to give you lots of ways to format your document: inline and tables, element reports, matrix reports and Model-view based.

But sometimes, all these options aren't enough. This may be because your document needs to conform to an existing pattern, or where you're using EA in a way which we just haven't seen before.

This is where Scripted Formatting might help.

It allows you to create little EA Scripts which act as mini-eaDocX Generators, creating those little bits of your document which regular eaDocX can't manage.

A warning though. Writing EA scripts is not for the faint-heated! It requires knowledge of both Script programming, and of the internal of EA. You don't need to know about either of these to make the rest of eaDocX work, so including this feature goes against what eaDocX is trying to do - create quick, simple, great-looking documents. So we don't expect many eaDocX users to use Scripted Formatting, but it should allow those users with really complicated requirements to keep using eaDocX, and stop eaDocX from getting more complicated.

Setting-up Scripting

Regular eaDocX works by creating a Profile for all the Element Types and Element Stereotypes which you need to print. Each one can print differently: inline, as a table row, or not at all.

Scripted Formatting just adds a new option to this list. You can tell eaDocX to use a script to print either all instances of an element or of a  type+stereotype.

You write the Script in EA, and (with a little effort) you can access many of the regular eaDocX features, such as Word styles.

Your script will get sent a set of elements which eaDocX wants to print for you - all the elements of the same type or type+stereotype -  so your script can decide whether to print the elements one at a time (like inline) or as some kind of table.

See also - Hints for writing (VBScript) Scripts

Some examples

To get you started, we have provided some example scripts which you can download from See Sample scripts on the website (registered users only).

Sample File



This sample just tests that eaDocX can talk to a script, and pass it it some parameters. Shows you what parameters are passed to your script by eaDocX.


Prints a set of elements as a bullet list (HTML Simple List) containing just their names


Prints a slightly more complex bullet list, which looks like:

Element1 name : element1 notes

Element2 name: element2 notes

Table 1

Simple table, with one row per element. Duplicates what can do more easily using standard eaDocX 'Table' formatting, but can be modified to make more complex tables.

Table 2

More complex table, using colSpans to make sub-tables. This function isn't available in standard eaDocX

All of these examples create HTML which will be formatted using default Word styles, so, depending on how you have setup the styles in your Word document, the output may look different from the rest of your document.

Using Word Styles in your Scripts

You have two options if you want to use Word Paragraph styles in your eaDocX Scripts:

Use the same Style definitions which the rest of eaDocX uses, so that your output looks the same as other eaDocX-generated output

Use different Word styles, so that you can make your Script-generated content have styles which are deliberately different to those used by the rest of eaDocX.