We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question
0

Exclude a style from exporting [closed]

asked 2020-12-29 09:28:16 +0200

Rackover gravatar image

updated 2021-06-01 22:05:32 +0200

Alex Kemp gravatar image

Hello,

I'm working on a document that should exist in two versions - one normal version, and one version with extra informations here and there aswell as additional paragraphs.

I currently marked the extra paragraphs with a different paragraph style and color, but exporting two PDF from a single office file is still a hassle - i have to remove everything by hand, then export, then put them back, which is prone to error too.

Is there a way to export a ODT to PDF but "excluding" an entire style, that is, acting like if it wasn't here at all (even if that changes layout) ? This way I could export my master with the comments and export the commentless version with the same file.

Kind regards,

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2021-06-01 22:05:43.008558

Comments

As I understand, you want both remove a style and remove any paragraphs formatted with that style, right? I doubt that it is possible in any other way than writing a macro.

gabix gravatar imagegabix ( 2020-12-29 10:52:46 +0200 )edit

I do not want to remove a style, I want to export a PDF document that omits every paragraph with style X. without having to remove said style or said paragraphs from my document before.

Rackover gravatar imageRackover ( 2020-12-29 11:08:40 +0200 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2020-12-29 11:29:21 +0200

LeroyG gravatar image

You can assign a style (or a group of heir styles) to the extra informations, and modify the (parent) style Hidden font effect before exporting the second file.

Tested with LibreOffice 6.4.7.2 (x86); OS: Windows 6.1.


Add Answer is reserved for solutions. If you think the answer is not satisfactory, add a comment below, or click edit (below your question) to add more information. Thanks.

Check the mark (Answer markCorrect answer mark) to the left of the answer that solves your question.

If the answer helped you, you can mark the up arrow (Upvote mark) that is on the left (to vote, you need to have karma of at least 5).

edit flag offensive delete link more

Comments

This is very cool! Is there a way to make this automatic upon export, to generate to files? Via script or something maybe?

Rackover gravatar imageRackover ( 2020-12-29 17:34:28 +0200 )edit

Take a look at the answer for /question/136558/.

LeroyG gravatar imageLeroyG ( 2020-12-29 17:39:10 +0200 )edit
1

answered 2020-12-30 15:22:29 +0200

ajlittoz gravatar image

What you are looking for is usually called conditional text, i.e. part of the document is displayed depending on a condition. This requires to mark up your text.

First, at the beginning of your document, define a variable which will tell when the controlled text is hidden.

  • Insert>Field>More Fields
  • go to the Variables tab
  • in Type click on Set variable, type public in Name and 0 in Value
  • push Insert

With public set to 0, all the document is visible. When it is set to 1, only non-confidential content is shown.

Now, you're ready to mark up your document.

At the beginning of restricted paragraphs:

  • Insert>Field>More Fields
  • go to the Functions tab
  • in Type click on Hidden Paragraph, in Condition enter public
  • push Insert

This keeps all styling possibilities unchanged for the paragraph and does not require a specific style.

Hiding individual words is also possible but not very flexible (all words in a "sequence" must have the same character style). Proceed as above but select Hidden text and enter the word in Hidden text instead of inside the paragraph.

I highly recommend you enable View>Formatting Marks and View>Field Shading so that you have visual cues about the existence and location of the various fields.

To change the display condition, double-click on the public definition and change its value.

To show the community your question has been answered, click the ✓ next to the correct answer, and "upvote" by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.

edit flag offensive delete link more

Comments

Don't works for me (LibreOffice 6.4.7.2/7.0.4.2 (x86); OS: Windows 6.1). What could be the problem?

LeroyG gravatar imageLeroyG ( 2020-12-30 15:45:06 +0200 )edit

The condition tells when text is hidden (not when it is shown, what users usually expect). Otherwise you must write a full "equation" like public == 0. What is not user-friendly is you must define a variable. It would have been better to work with a File>Properties, Custom Property.

If it still doesn't work, attach a sample file to a comment (I assume you know the trick as you're now a power user of this site).

ajlittoz gravatar imageajlittoz ( 2020-12-30 16:50:06 +0200 )edit

Got it. Choose menu Tools - Options… - LibreOffice Writer - View, and uncheck Hidden paragraphs.

Thanks.

There is a way to hide the 1 or 0? OK. I answer me. Check the Invisible field in the Edit Fields dialog. :-)

LeroyG gravatar imageLeroyG ( 2020-12-30 17:03:03 +0200 )edit
1

When editing, as an author, you should always keep hidden text visible. When the condition is in effect, hidden paragraphs have a dotted underline, just like text styled Hidden. I prefer this so that I always know if there is real conditional text or not. I admit it is more difficult to get the look of the final document but it avoids many mistakes.

ajlittoz gravatar imageajlittoz ( 2020-12-30 17:11:30 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2020-12-29 09:28:16 +0200

Seen: 42 times

Last updated: Dec 30 '20