Source and Destination formatting in version 4

There was a change in Version 4 with the style handling with BaseTemplate,  IncludeTemplate and InsertTemplate template.

How it worked in version 3 of XpressDox

With version 3, when Source formatting was used, XpressDox would create a new style in the destination template for every style in the source template, but with a new name. (Note that with IncludeTemplate and InsertTemplate the template being included/inserted is the source template; with BaseTemplate the template in which the BaseTemplate command exists is the source template). If the style was called “Normal” in the source, then a new style called “NormalDX” (copied from the source template) would be created in the destination document, and all the paragraphs included from the source template which were formatted with style “Normal” would be changed to be formatted with the new style “NormalDX”. This applied to all the styles in the source template, so the merged document would contain a number of “…DX” styles.

There were some problems with this approach, even though the result was that the merged document looked like what was desired. These problems were that every template that was Included or Inserted would cause a new set of styles to be created in the merged document, so that in a typical situation with a number of Included/Inserted templates, the merged document would end up with a whole slew of new styles called “NormalDX”, “NormalDXDX”, etc. This situation was incompatible with situations where XpressDox users were relying on Word’s styles for the formatting of their documents and had set up sophisticated style regimes for their documents – the introduction of numerous new styles was not welcomed.

Taking all of this into account, the style merging in version 4 was changed.

How it works in Version 4

What happens with version 4 is that when the Source formatting option is used in the include/insert command, the styles in the source (included/inserted) template are copied into the destination document with the same name as they have in the source template – in effect, because no new styles with new names are created, the styles in the destination template end up being replaced by the styles with the same name in the source template. (Any styles in the source template which are NOT in the destination are copied over without change into the destination, and with the same name as they had in the source template.)

With the Destination option, the styles are only copied from the source template into the destination when a style appears in the source template but no style with that name appears in the destination template.  The functioning of the Destination option is basically unaltered  changing from Version 3 to Version 4.

What this means is that, suppose for example that all the paragraphs in the source and destination templates are formatted with style “Normal” (which is probably usually the case when no special style creation has taken place). With the Source option, all of the paragraphs in the merged document (i.e. not just those copied from the source template, as happened with version 3, but also those in the destination template) end up being formatted according to the Normal style which is in the source template. When the two Normal styles are exactly the same, then there will be no difference between the paragraphs in the merged document and those which originated in the source or destination templates. But when the Normal styles in the two templates are different, then all the paragraphs in the merged document which were originally in the destination template will have a different appearance as they will have been re-formatted according to the Normal style in the source template.

An example

These different scenarios have applicability especially in a situation where there are a number of different but similar formatting requirements. For example, suppose you have a template which is used as a letterhead by all the departments in an organisation, but some departments have special requirements. Suppose most departments will use the Arial font on their letters, and use a line spacing of 1½ lines, but one or two departments need to use font Verdana and the line spacing should be single. It would then make sense to create a style called, say LetterStyle, which has font Arial and 1½ line spacing, and use that style in the letterhead template, and also in the letter templates which use the letterhead template via «BaseTemplate()». The letter templates for the two “Verdana” departments would then all be created with a LetterStyle which has font Verdana and single spaced paragraphs.

Then in both cases, the letter templates could use the Source option in the BaseTemplate commands, and the result would be the desired one.

Note that as long as the Source option is used, then the LetterStyle in the letterhead (the base template) can have any arbitrary characteristics (even Courier font and double spacing) because the Source option will ensure that the LetterStyle style in the source template will be the ruling style in the resulting document.