Writer: How to hide text, paragraphs, selected text with its heading?

This is not a question, rather an answer to the multiple questions around here which were answeerd unsatisfactory.

Problem:

So, the question was, how can I have paragraphs, namely Heading+Text Body which can be hidden and shown with hopefully “one click”?

My actual task was create a large document, covering a topic is basic, advanced and wizard level, and I want to be able to create 3 separate documents as a result, one for beginners, one for wizards, etc., the former containing only simple topics, while wizard book would contain all topics (this is not a manual but a stupid legal text, so forgive me the bad analogy).

Solution

I will use self-hiding paragraph styles, my example is on v24.2 but shall work on wide range of versions, just the dialogs wander a bit around.

  1. There are lot of default styles, including Text Body and various Headings. They are inheriting styles from specific parents, usually leading back to Default Paragraph Style.
  2. Let’s create a new Style, called Hiding 1 (there can be as many hiding category as you wish, I will only create one here), its parent should be your base style or Default Paragraph Style. This will be my base style where all hidden paragraphs will be its descendants. (If you need multiple categories of hiding, you’d cerate Hiding 2, … etc)
  3. Create a List style (left Styles toolbox aka F12) for header numbering if you want to number them, say, MyHeaderList. (You need this to be able to have multiple Heading styles have the same outline level.)
  4. Create duplicates of the Styles you would normally use (unfortunately I see no duplicate style or copy style functionality, so you have to do it manually), make their parent Hiding 01, and set their Outline & List properly, outline levels to matching level, List style is MyHeaderList. Practically Next style should be Hiding 1 BodyText.

You would end up something like this:

Default Paragraph style
 |    |
 |  Body Text
 |     |
 |   Heading
 |    Heading 1
 |     Heading 2 …
 |
 Hiding 1
   |
  Hiding 1 BodyText
    |
    Hiding 1 Heading
     Hiding 1 Heading 1
      Hiding 1 Heading 2
       Hiding 1 Heading 3 …

I additionally set the Hiding 01 style Area to a pattern and Transparency to 90% to make all of its descendants (both body text and headers) have a visible, different background.

  1. Update original Heading styles to use List style MyHeaderList as well, so your numbering will be continuous.

Now, you simply use Heading 2 for 2nd level headers and Hiding 1 Heading 2 for hidden headers, and accordingly Body Text or Hiding 1 Body Text for their body. All of them will be visible, latter with a background if you set it.

Hiding

Now hiding is real simple:

  1. Edit Hiding 1 style
  2. Font effects » Effects » Hidden: yes (check)
  3. Ok

Boom, everything’s gone from view. It properly updates ToC and whatnot.

I hope it helps. :wink:

ps

  • Using Sections is a different solution, but it’s very inconvenient to use scattered around within a document.
  • Using variables didn’t work for me, and it’s pretty inconvenient anyway.
  • Most of the suggestions here simply didn’t work (anymore?)
1 Like

It would be better to keep the “problem” in the question, and move the solution here.

Your wish is my command. :slight_smile: