Can you use conditional text in LibreOffice?

I just want to know if it is possible to tag/mark content in LibreOffice and then save out different versions of the document, based on the tags selected, i.e. a generic version, a customer-specific version, a feature-specific version.
This means you have one base document, that can be saved as different versions, based on what has been tagged.
Any info gratefully received.
Fee

There exists several ways for conditional text. But that is only for print and screen (and perhaps pdf-export). But in the document the not visible parts still exist.

What kind of text do you want to exchange? If it is name and address e.g., then you can use fields.

For larger text fragments, you can use sections. You put the text fragment into a section (Insert → Section) and hide the section with a condition that uses the value of a variable. Insert such variable at the beginning of the document. Later you can easily modify these sections with Format > Sections.

The attached document ConditionalSections.odt has a variable “printcondition” at the beginning of the text, which is used in the conditions. You can insert such variable with Insert → Fields → More Fields (or Ctrl+F2) → tab Variables → Set variable. Notice the checkbox “invisible”. To edit the value of this variable later on, set the cursor in front of it and call Edit > Fields. In case you do not see the correct place, use View → Field names toggle.

I have generated several sections in the attached document. The “generic” sections (green background) have got condition “printcondition LEQ 1”. Notice, that you cannot use <=1 but need the special syntax, see section “Formula” in the Writer Help. The sections are hidden for value 1 but shown for value 2, 3, … The “custom-specific” sections (yellow background) have got condition “printcondition LEQ 2”. So in case value 1 and 2 they are hidden. Analogous “special-edition” section (red background) have got condition “printcondition LEQ 3”. So they are hidden for values 1,2,3 but shown in case of value 4.

It is also possible to use “hidden text” or “hidden paragraph” from Insert → Fields → More Fields → tab Functions. But for me sections are easier to maintain.

1 Like

But in the document the not visible parts still exist.

I agree. But… you could insert a linked section from another document. This document could be changed when your container document is to be finished; after that loosen the link/embed the former linked content…

What kind of text do you want to exchange? If it is name and address e.g., then you can use fields.

I agree once more. The purpose of your proceeding is the gist!

What I’m looking for is the ability to tag sections of a document as follows:
“generic”, “customer-specific” and even “special edition”.
Then, if I want to save or print a “generic” version, the output will contain only the content taggd as “generic”.
If I wanted to save or print a “customer-specific” version, the output would contain content tagged as both “generic” and “customer-specific”, and so on.
So it means having all content in one document, but being able to save out different versions