Hide and Go Seek with Writer Content

May 20th, 2006 by Bruce Byfield in

By using Writer's hide functions, you no longer need to worry about multiple versions of a document remaining in sync.
Your rating: None

Why would you want to hide content in an OpenOffice.org Writer document? The most common reason is to maintain two similar versions of a document within the same file. For instance, if you are a teacher preparing an exam, you might want to use the same file to print a version of the exam to distribute to students, and another one, complete with answers, to give to markers. If necessary, you can view the complete document on the screen, but when printing or sharing files, you can hide or reveal content depending on what you want each audience to see. By using Writer's hide functions, you no longer need to worry about multiple versions of a document remaining in sync.

Another reason to hide content is if you are commenting heavily on a document, either as a collaborator or an editor. As many people have found, a note is inconvenient to use in Writer, because you have to click on a small, often hard-to-see field to read it. Rather than using a note, you might prefer to use hidden content instead.

Whatever your reason for using hidden content, you have three possible methods: using fields, sections or styles. The features of each of these methods overlap, but each has pros and cons that you'll need to know so you're not hopelessly frustrated as you hunt for the content you've hidden and set up the file for each audience.

Hiding Content with Fields

Figure 1. You may see fields used for hiding content, but consider them deprecated features because of their awkwardness.

Until version 2.0, fields were the most versatile way to hide content. From Insert→Fields→Other Functions, you can choose Hidden text to conceal less than a paragraph and Hidden Paragraph to hide a complete paragraph.

Setting up either type of field is relatively easy. In both cases, the content is revealed by setting the condition in the field's dialog box to 0, and the content is hidden by changing the field to 1. If you want to hide the field more deeply, you can set the condition using Boolean logic and the properties defined in Files→Properties→Description or the user listed in Tools→OpenOffice.org. For example, if the title listed in Files→Property is Introduction, you can set the condition for a field or section to TITLE EQ Introduction. By changing or removing the title before you distribute the document, you can be reasonably sure that nobody else will ever read your hidden text or paragraph.

However, in other ways, both fields are awkward to use. For one, despite the names, the two types of fields function differently. Using hidden text, you either highlight the text you want in the field or type it in the dialog box. By contrast, a hidden paragraph field is a marker you can place anywhere in a paragraph. In addition, as you use either one, you need to know that Writer can be set to display either type of field, regardless of the conditions set if you select Fields: hidden text or Fields: hidden paragraphs in Tools→Options→OpenOffice.org Writer→Formatting Aids. You'll want to remember the formatting aids option if the fields don't seem to be working, and possibly to turn them on and off while you are setting up the fields. But, unless you're using both types of fields regularly, all these quirks can be frustrating.

Each of these fields also has its own limitations. To use hidden text fields successfully, remember to put the spaces on one side of the hidden text so that the rest of the paragraph is set out correctly when the field is hidden. Moreover, as should be obvious from the name, hidden text does not work properly when the field extends over the end of a paragraph. Nor are hidden text fields the easiest to find and edit when fields are set to display in the default gray--although, once you find one, you can use the Previous and Next arrows in the dialog to move among them. Hidden paragraph fields are just as awkward to edit, requiring that you turn on the formatting aid option to view them.

But perhaps the worst feature of both is that managing a large number of them is almost impossible. Neither hidden text nor hidden paragraphs can be arranged in groups, such as text that you want to activate only in the teacher's copy of an exam. Instead, each must be managed separately. This limitation makes either type of field impractical for any wide-scale use.

My advice is to avoid using either type of field for hiding text. You should know that these options are available, because they might be used by others, or in older documents, but, if you are using version 2.0 or higher, consider them deprecated features. If you are using Writer in a business setting with sophisticated users, you also should discourage their use in the office style guide. With later versions of OpenOffice.org, you can get the same functionality in other features with fewer difficulties.

Using Sections for Hiding

Figure 2. Sections are more versatile than fields for hiding content, but need to be at least one line long.

Sections are portions of a document, at least one line in length, that are formatted differently from the rest of the document. They are added using Insert→Section, and existing ones are edited using Format→Sections. The same options are available from each location. In both cases, you can hide a section by selecting the Hide option on the Sections tab of the dialog window. Optionally, you can set conditions in the same way as for a field, although the only reason for doing so is for added security.

Using sections to hide text has several advantages over using fields. First, sections can be named on the Section tab. If you have several different circumstances under which you might want to hide text, you can make your administration easier by including a common element in each company's section names. For example, the unique sections for Penguins, Inc., might all start with the general prefix Penguin and end with a specific identifier, such as Bio. By using such a system, you will easily know which sections to enable for Penguins, Inc. You also can press F5 to open the Navigator and see all the sections in the document, with their names grayed out if they are currently hidden. When you want to unhide a section, you can use Format→Sections without actually moving the mouse to the section you are editing, which is useful, because nothing but the mouse position actually reveals a hidden section, and you can't open one by clicking it.

Just as important, no option to view hidden sections exist, giving you one thing less to worry about while setting them up. Also, selecting a check box with the mouse is far easier and quicker than changing a condition.

Overall, sections are a far more efficient option than fields for hiding text. The only disadvantage is that they are not practical for hiding less than a line.

Using Styles for Hiding

Figure 3. Both characters and paragraph styles are the easiest way to hide content.

Since the introduction of version 2.0, the easiest way of hiding text is to use styles. The Font Effects tab of both character and paragraph styles now includes a check-box option to hide the style. Although you cannot set up a more elaborate condition than on/off, the way you can with hidden fields or sections, for most users, this option should be more than enough.

The same option is available from Format→Character--although not from Format→Paragraph. However, as always, the advantage of using styles over manual format is the ease of administration. As with sections, you easily can set up character and paragraph styles with names that indicate the sort of information they are used for. Then, as you reveal and hide different blocks of text in preparation for printing, all you need to do is press F11 and select or de-select the Hide option on the Font Effects tab for each style as needed. Even with a complicated setup, you can be ready for printing in a matter of minutes--all without ever bothering to visit the individual blocks of text.

Like hidden fields, hidden character and paragraph styles always can be viewed on the screen if the right options are chosen. However, these options are much more complicated for character and paragraph styles. Not only does Tools→Options→OpenOffice.org Writer→Formatting Aids→Hidden text need to selected (and not confused with Fields: Hidden text or Fields: Hidden paragraphs, but View→NonPrinting Characters as well. Then, just to complicate things further, viewing hidden paragraph styles also requires selecting View→Hidden paragraphs. The reason for this complexity frankly baffles me, but because you can easily reveal and hide styles without it, you can ignore it if you choose.

Figure 4. The Printing option provides a way to hide contents in a frame.

As well as characters and paragraphs, you also can use styles to hide material in frames, such as pictures or formulas. Each frame style can be hidden by de-selecting the Printing check box on the Options tab. However, unlike character or paragraph styles, a frame style and its contents continue to be visible on the screen. You see only the result of de-selecting the box when you select File→Print Preview or actually print or export the file.

Using styles to hide content has its own inconsistencies. However, they are fewer than those for fields or sections, so my recommendation is to use styles for hiding content in preference to any other method.

The Tell-Tale List Number

No matter which method you use for hiding content, one last problem remains: when a numbered paragraph is hidden, numbered lists are not automatically renumbered. The easiest way to overcome this problem is not to use numbered lists in hidden content at all. However, if a numbered list is unavoidable, you can overcome the problem by creating two paragraph styles with identical formatting, one for ordinary content and one for hidden content. Set both styles to use the same numbering style on the Numbering tab, then each time you hide content, set the style for hidden content not to use any numbering style.

Mentioning this workaround underscores the importance of organization when working with hidden content. Although I recommend styles, making sure you that you hide or reveal the way you want requires a consistent work flow. Knowing the quirks of each method is important, but you also need to be systematic, setting conditions you remember, naming sections and styles in a way that eases the work, and above all, checking your work before you print or export it. Otherwise, you may find your clients reading abusive comments made by other employees, or exam-takers getting the answers--and you becoming embarrassed or unemployed because you got careless with an advanced feature.

Bruce Byfield is a computer journalist and course designer. His articles appear regularly on the Linux Journal and Newsforge Web sites.

__________________________

--
Bruce Byfield (nanday)


Special Magazine Offer -- Free Gift with Subscription
Receive a free digital copy of Linux Journal's System Administration Special Edition as well as instant online access to current and past issues. CLICK HERE for offer

Linux Journal: delivering readers the advice and inspiration they need to get the most out of their Linux systems since 1994.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
John Beech's picture

Helpful where help wasn't

On April 9th, 2008 John Beech (not verified) says:

Hey Bryce, thanks for the educational article.

I skipped through the article to the bit on the hidden text property usable in styles. After coming from a HTML/CSS publishing route styles are my bread-and-butter for organising content, and hiding paragraphs by style was exactly what I was looking for when removing framework comments from my report. Searching for 'hidden text' in OpenOffice writer help came up with the jargon about inserting hidden fields and using frames to hide printable content, really not what I was looking for.

Best regards,
- John

David Forsythe's picture

Good For Summary versus Detail

On May 27th, 2006 David Forsythe (not verified) says:

This will be great for us as we send mail out about our uv
bulb
options for our fly killers. Some customers need lots of detailed
specifications and others just need summaries. The specs are often changing, so having the summary & detailed information on one document is a good solution. We just need to hide the detail as & when necessary. Just wish that paragraph numbering could be automatically reformatted to take into account what is visible.

Anonymous's picture

Actually LyX has this too...

On May 21st, 2006 Anonymous (not verified) says:

...it's called 'branches' and from what I read here, easier to use and more versatile. I use it all the time to produce multiple-language versions in one document.

KJK's picture

Helpful article...period

On May 21st, 2006 KJK (not verified) says:

While you may be right that the two-document approach will be used by many people, I think that has more to do with being unaware of the options for hiding text or laziness in changing old habits. In many cases, I doubt this will be an intentional choice based on the merits of the possible options. The list number issue will certainly make a difference in some cases, but I have a feeling it is not going to be a factor in 99% of cases that could benefit from hidden text. Well, the number may be more like 90%, but you get the idea.

The other REALLY good reason that comes to my mind for maintaining two documents is when you will be distributing one of them in electronic format. Hidden text seems best suited to documents that will be printed. Having a separate document is the safest way to keep information from those who should not have it. I have seen my fair share of MS Word snafus that result in people finding information that was to be hidding (mostly from the change-tracking features).

In the end, I think Bruce clearly lays out the reasons for putting the information into a single document, so I am not sure how you missed that. Most importantly, he is not trying to convince anyone that this is the best approach for all cases. In addition, he does not only tell us about the one method that he thinks is best; he explains all three and lets us decide for our own needs. This is the definition of well-balanced writing.

Thanks for providing good insight, as usual, Bruce. Keep the articles coming!

Post new comment

Please note that comments may not appear immediately, so there is no need to repost your comment.
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd> <i> <b>
  • Lines and paragraphs break automatically.

More information about formatting options

Newsletter

Each week Linux Journal editors will tell you what's hot in the world of Linux. You will receive late breaking news, technical tips and tricks, and links to in-depth stories featured on www.linuxjournal.com.
Sign up for our Email Newsletter

Tech Tip Videos

From the Magazine

July 2009, #183

News Flash: Linux Kernel 3.0 to include an on-the-go Expresso machine interface! Ok, maybe not, but Linux is definitely going mobile, from phones to e-readers. Find out more inside about Android, the Kindle 2, the Western Digital MyBook II, The Bug, and Indamixx (a portable recording studio). And if you've gone mobile and you been wanting more Emacs in your life then check out Conkeror.


To compliment the mobile we've got the stationary: parsing command line options with getopt, checking your Ruby code with metric_fu, and building a secure Squid proxy. How is this stationary you ask? What can we say? It's not. We just wanted to see if anybody actually read this part of the page :) .


All this and more, and all you have to do is get your hot sweaty hands on the latest copy of Linux Journal.





Read this issue