One LibreOffice document for multiple uses

Automating the Use of Fields and Sections

Field windows stay open after you insert a field, allowing you to move to the next position for a field in the document. Section windows do not, but you can use the navigator to jump from one section to the next.

However, changing the conditions for each field or section individually eats up time. If the same field appears more than once, you can copy and paste or use Edit | AutoText so that you can add information with a couple of keystrokes instead of making changes manually.

Better yet, you can set a general variable that toggles all fields at the same time:

  1. Place the cursor at the start or end of the document, or anywhere else that is easy to locate.
  2. Click Insert | Fields | More Fields | Variables | Set variable.
  3. Set the Format. You can leave it as General or specify it as Text or one of the number formats.
  4. At the bottom of the window, give the variable a name. The name can indicate one of the document versions or be something like MasterSwitch.
  5. Enter a value. It can be text or simply 0 or 1, but make sure it uses the format entered in the fields.
  6. Click the Invisible box so that the variable cannot be seen in the document. Then click the Insert button. Locating the variable later can be difficult, which is why you should place it in some easy-to-find place. You might choose to leave it visible while you work. If you do lose track of the variable – something that is surprisingly easy to do – search for it using Edit | Track Changes | Manage Changes. When you highlight it in the Manage Changes window, the variable is revealed on the screen as a thin, light-blue field.
  7. In all the Conditional text, Hidden text, and Hidden Paragraph fields in the Functions tab, as well as Sections (which I discuss in the next section), set the condition to the variable name, followed by the value in quotation marks (e.g., MasterSwitch "0" or AdminGuide "1".

Now you show or hide all the fields in the document by changing only the variable, much as you would with a style.

If you have more than two versions of the document, you can create other variables, to toggle each one off and on. However, make sure that the values are different for each and that each is placed where you can easily find it.

Hiding with Sections

Sections are areas with properties that are different from the main body of text. These properties may be formatting or content that is password-protected from editing. Sections work in much the same way as fields:

  1. Place the cursor where you want an empty section, or highlight existing text. Select Insert | Section. The Insert Section dialog window opens (see Figure 6).
  2. Give the section a unique name that reflects its contents and, if desired, protect it with a password.
  3. Click the Hide box or set the With Condition field to 1. One or the other is necessary, but not both. When you close the dialog window, the section and the space above and below it are no longer visible in the document. A section set to hide is visible until you remove the mouse cursor from it, so do not be surprised if it remains visible for a moment.
  4. When you want to edit the section, click Format | Sections. The dialog window lists the document's sections, with an open or closed lock beside the name to indicate whether it is hidden. Sections can be formatted without unlocking them, but they must be unlocked to edit the text.

    Figure 6: From the Insert Section dialog, you have another way to hide or reveal large sections of text.

Getting Organized

Hiding text might seem confusing at first, especially when Boolean logic is mentioned. However, if you think of these features as essentially off and on switches, then perhaps they will seem more straightforward.

Of course, being organized always helps, as well. If you are faced with maintaining multiple versions of a text, specify in your outline in which version or versions to include each topic. You might change your mind as you write, but if you do, a change of paragraph or character style should be all you need to revise the document.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News