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.

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