Use Google to find help fast. For example, search on "xpressdox choosefromlist".

RemoveParagraph: remove unwanted paragraphs

RemoveParagraph: remove unwanted paragraphs

XpressDox does its best to make sure it doesn’t leave unwanted paragraphs lying around after a template has been merged, as explained in Using block commands .

Sometimes this is just not good enough, and a command or group of commands or functions will leave one or more empty paragraphs in a merged document. An example would be the GetV, SetV and SaveV functions. Because of the nature of variable handling, these functions are processed by XpressDox as one of the last things that it does with the template, which means they are processed at a stage where the automatic paragraph removal logic applied to the block commands is no longer available.

Here is a snippet from the Handling gender Cookbook recipe:

<<ChooseUsingCheckBox (PartyIsMale)>>
<<If(PartyIsMale = “true”)>>
<<SetV(“he”,”he”)>>
<<Setv(“him”,”him”)>>
<<SetV(“his”,”his”)>>
<<Else()>>
<<SetV(“he”,”she”)>>
<<SetV(“him”,”her”)>>
<<SetV(“his”,”her”)>>
<<End()>>

While this code will “work” and is nicely legible, each of the lines (which in Word are paragraphs) with SetV on them will create an empty paragraph on the merged document.

The RemoveParapgraph() command will solve that problem, thus:

<<ChooseUsingCheckBox (PartyIsMale)>>
<<If(PartyIsMale = “true”)>>
<<SetV(“he”,”he”)>> <<RemoveParagraph()>>
<<Setv(“him”,”him”)>> <<RemoveParagraph()>>
<<SetV(“his”,”his”)>> <<RemoveParagraph()>>
<<Else()>>
<<SetV(“he”,”she”)>> <<RemoveParagraph()>>
<<SetV(“him”,”her”)>> <<RemoveParagraph()>>
<<SetV(“his”,”her”)>> <<RemoveParagraph()>>
<<End()>>

But any even nicer way to get those extra paragraphs removed from the merged document is to use the SetVr function. This does exactly what the SetV function does, but also removes the entire paragraph in which it occurs:

<<ChooseUsingCheckBox (PartyIsMale)>>
<<If(PartyIsMale = “true”)>>
<<SetVr(“he”,”he”)>>
<<Setvr(“him”,”him”)>>
<<SetVr(“his”,”his”)>>
<<Else()>>
<<SetVr(“he”,”she”)>>
<<SetVr(“him”,”her”)>>
<<SetVr(“his”,”her”)>>
<<End()>>

Please see The Gender Function for a short-hand version of how to handle gender.

Leave a Reply