Searching for hidden text

This question has been asked before (How can I search on the hidden text attribute?), but the accepted answer is not satisfactory as I explain below.

LibreOffice’s search/replace functions appear not to offer any way of searching on the ‘Hidden’ character effect. This seems to be a basic omission, as it does allow searching on the other effects: Case, Relief, Outline and Shadow.

The accepted answer of using the Alternative Find & Replace extension does not work. The extension is unmaintained for the last 3 years. With LibreOffice 7 it spuriously deletes characters at the cursor, and more significantly fails to search on the CharHidden property only. That is, if I ask it to search for a specific hidden character then it works, but asking to to search for any hidden character does not.

Does anyone have a better solution?

[UPDATE in response to @ajlittoz]

My use case is that I have a series of RTF documents from a third party source that for no obvious reason contain small amounts of hidden text that is obviously redundant. I need to convert these files to other formats including text for the purpose of further processing. For that purpose I am using unoconv and LibreOffice - there are alternatives for converting to text but not (AFAICT) for converting to other formats. If I convert to ODT or DOC then the hidden characters remain hidden and don’t present a problem. But when I convert to text they stop being hidden and start to cause problems.

So, long story short, I don’t want to see the hidden text, I just want to get rid of it.

For a better solution, explain your use case of Hidden attribute. If your goal is only to find where you have hidden text, make sure you have configured Tools>Options, LibreOffice Writer>Formatting Aids to display hidden text. Enable then View>Formatting Marks.

Quite a long time since I fiddled with RTF. A better angle of attack would be to consider how RTF marks up hidden text. You can then script a text editor to remove the markup and associated text (from opening tag to closing tag). Seams to me this could be easier and driven from a shell script.

Once you have a clean RTF source, you can use Writer to convert to other formats.

I have looked for a real solution for the issue of “search hidden text” in Writer, that is, not viewing hidden text; and I am a bit surprised how the issue is bypassed, suggesting “solutions” which are not solutions. The issue can be solved only by adding a function to the search menu, where also the attribute “hidden”, and even only that, in case, can be chosen.
I am a supporter of the wonderful LibreOffice project, but I find a bit confusing that solutions which are not solutions are presented as such.
Is there any hope that a real, robust feature of “searching by attribute”, including “hidden”, will be considered in the near future?

Many thanks for your attention

This request is a consequence of user-adopted workflow. Writer fundamental principle is styles. If you drop Word-induced direct formatting to adopt styling (and stonger “semantic” styling), you no longer need to search for such or such attribute. Instead you manipulate your styles in a way they have visual effect on screen.

Thank you so much for your time.

I fully understand, and I am a user strongly and consistently committed to using and marking by styles. That’s exactly, from a non-expert point of view, one of the many reasons why I definitely prefer Writer & LibreOffice to other word processors. Still, anyone should admit that there are cases when a search function by “hidden” is useful, necessary, and unavoidable. The paradox is that, in the absence of this function, I have to mark additionally hidden text as style in a file, by using an alternative word processor, before dealing with it properly in “Writer”. Take for example cases when files are imported, where no markig of hidden text by style was applied. This happens quite often.

Indeed there are cases where it is helpful. I checked the various options of Find & Replace and was surprised to see that Font Effects tab of Format button does not offer Hidden attribute. Perhaps worth an enhancement request as Shadow and Outline are already there.

Thank you! This is exactly what I mean: why other attributes, and not “hidden”?

A workaround for hidden paragraphs (not consistent for parts of paragraphs):

By some (strange) reason, when text is selected in Block mode (Block selection), hidden paragraphs are not selected.

So you can:

  1. Activate Block selection in the Status bar image description, and select all text holding Shift and using the movement keys (in the longest line, press End and Down Arrow), release Shift¹
  2. Apply a font effect not used in the text (e.g. Strikethrough, not all font effects work here)
  3. Unselect text (Esc), and select all again in Standard selection mode (Ctrl+A)
  4. Choose menu Format - Character… - Font Effects tab, unmark Hidden, OK
  5. In the Find & Replace dialog, Format… button - Font Effects tab - Strikethroughvalue set to (Without) - OK - Find All button - Close button
  6. Delete (you will get a empty paragraph for each one deleted)
  7. Select all text and reverse Strikethrough

¹ The same result is achieved holding Alt while selecting with the mouse.

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.

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).

1 Like