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:
- Place the cursor at the start or end of the document, or anywhere else that is easy to locate.
- Click Insert | Fields | More Fields | Variables | Set variable.
- Set the Format. You can leave it as General or specify it as Text or one of the number formats.
- 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.
- Enter a value. It can be text or simply 0 or 1, but make sure it uses the format entered in the fields.
- 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.
- 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:
- 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).
- Give the section a unique name that reflects its contents and, if desired, protect it with a password.
- 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.
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.
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
So Long Neofetch and Thanks for the Info
Today is a day that every Linux user who enjoys bragging about their system(s) will mourn, as Neofetch has come to an end.
-
Ubuntu 24.04 Comes with a “Flaw"
If you're thinking you might want to upgrade from your current Ubuntu release to the latest, there's something you might want to consider before doing so.
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.