I use notepad for some rule based highlighting of text... but I need more control/formatting. So I moved to open office... rather than search and replace, which requires repeated use ever time I change/add text... is there any way to apply rule based highlighting/formatting? Ideally being able to prevent the rule from being applied to specific text.

e.g., I might need the work para colored green for almost every instance but not all... but there is no rule that works since some context is different.

e.g., I might have paraglider and paradiddle... but I do not want paradiddle highlighted for some obtuse reason which no rule can be used. I'd rather be able to select the word and tell open office not to apply formatting to that text specifically(a sort of exception).

If open office cannot do this does there exist any text editor that can but also allow for graphical formatting?

  • I was not aware that highlighting was possible in Notepad. Perhaps you are thinking of Notepad++ or another editor. – Jim K Feb 21 '18 at 19:43

Chapter 9 "MacroFormatterADP - Colorize code and XML" from Andrew Pitonyak's macro document gives a number of Basic routines for parsing.

My choice would be to write something similar using Python-UNO rather than Basic because string manipulation is much easier.

For the exceptions, the macro could prompt for each change ("Make this change? Yes/No"). Or, run the macro and then manually reset each exceptional paragraph to the default style.

Another possibility is to add some text such as DO_NOT_HIGHLIGHT to the end of such paragraphs and then set that to a character style that will be hidden when printed.

In the past I have written custom highlighting files for Vim, which works well. To add exceptions, perhaps hidden text such as DO_NOT_HIGHLIGHT could be added.

The rendering for Vim is not as graphical as LibreOffice or Apache OpenOffice, so, for example, it would not be as good for displaying right-to-left languages.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.