1

I want to automatically select all Text in a document that has a certain formatting property (i.e. every character that is underlined). Is there way to achieve this?

In the documentation I've found the SearchStyles property that comes most close to what I want, but I assume it looks only for the named formatting style that the text was given.

The background of my question is that I copy html text from the browser to the clipboard and from there into the odt-document. I can modify the html and thought of "marking" certain strings with the underline to later select them with an OpenOffice macro and reformat them (manually) the way I like to, but if that's not possible I'm thankful for every other hint, i.e. if there's a possibility to set a "style" already in the html that OpenOffice can understand.

Also if it's not possible in Open Office I have also access to MS Word if someone can guide to the right point in their documentation.

ascripter
  • 5,665
  • 12
  • 45
  • 68
  • I don't think it's possible to select more than one area programmatically (at least in MS Word), but in both you can Record Macro of changing the Find Format (Ctrl+F) and look at the generated code – Slai Jun 18 '17 at 13:19
  • In MS Word you can use the Find function: don't enter any text to find, click "Format", select "Font" and specify the type of underline you want to search for. Word will find all underlined text and you can move from one to the next by clicking "Find Next". To further automate this you might record the steps and/or look for code to "loop through all occurrences" in a document. – Variatus Jun 18 '17 at 13:30
  • I didn't know it was possible to search for formatting characteristics this way in both apps. Then I can do everything manually without macro with little effort. Thanks a lot Slai and Variatus :) – ascripter Jun 18 '17 at 13:36

0 Answers0