Deleting paragraphs

Sometimes, you’ll need to have a text fragment that, depending on the user’s input, might show up in the document. For example, a statement about free days in a employee agreement. However, if you do not want anything to show up in your document - not even a new line - you can use delete paragraph.

Consider this situation:

  • You have a paragraph consisting of both text fragments and static text containing more than just whitespace;
  • There is a circumstance in which neither the text fragments nor this static text should apply.

In this case you’d want to get rid of the paragraph altogether.

<text name="fragment1" /><text name="fragment2" />, and other, static, text.

To do so, you will have to explicitly remove this paragraph by creating a text fragment with exactly the same identifier as a text fragment used inside that paragraph. Then, in the dialog, tick the check box called ‘Delete paragraph’.

To illustrate this function, first create a text fragment with a value and give it an appropriate identifier (simply textfragment in this example). You can give it a condition or not (see picture below):

adding a text fragment
adding a text fragment

Now, you can add this text fragment to your document as described in adding text fragments. For good measure add some static text. The paragraph in Word could now read:

<text name="textfragment" />, and other, static, text.

Now add another text fragment with the exact same identifier of the text fragment that you want to disappear (textfragment in this example). Then, tick the box in front of ‘Delete paragraph’. The Text block field will turn gray and you won’t be able to add any text.

The last thing to do is to set the condition for which you want to have the paragraph disappear, let’s say when the value for show_text is ‘no’:

show_text = 'no'
removing the paragraph when a condition has been met
removing the paragraph when a condition has been met

In this case, if the answer to the question ‘showtext’ is ‘no’, the entire paragraph (or: paragraphs) that include a text fragment called textfragment will be removed from the output document. If you had not done this, any static text would have remained in the document.

Note (1): the order of your text fragments is crucial! If you want to delete a paragraph, make sure you do not give it a value later on in your model. The same applies the other way around: don’t select delete paragraph later on if you want it to show up in your document.

Note (2): In versions before 4.5 if you had a <text name="fragment1"/> on a line in Word, leaving it empty or not assigned would still let a blank line in Word. You needed to always delete the paragraph. Nowadays, if there is no static text, and all the fragments are empty, the paragraph will be deleted as well.