[N.b. Now updated for 5.0.x, and Gist updated/corrected. 20160229 | Still works in 22.214.171.124 20210417]
My earlier reply stepping through the regex/search-replace steps certainly works. But the original question included this:
I vaguely remember there being a process for LibreOffice, but it was pretty
complicated and involved using a lot of regular expressions in a non-intuitive way.
My sense about assigning this to a macro proved to be correct. Here is how you can (1) set up the macro, and (2) assign it to the menu bar for 1-click simplicity.
1. Set up macro
- Click on Tools > Macros > Organise macros > LibreOffice Basic… (a new window opens).
- In the left-hand box, you should see “[+] My Macros”. Open that up by clicking on the “plus” sign to get “[+] Standard”, open it and see “Module 1”, now click on it. You should now see “Main” listed in the right-hand box, “Existing macros in: Module 1”.
- Click on “Main” in the right-hand box, and now the “Edit” button to the right of it. A new window opens, and in the main text area, you should see “Sub Main” followed a blank line later by “End Sub”. Good.
- Now we need to get the LO Basic code to paste in below that “End Sub” line. I have saved this as a “gist” on Gitub, but go to the raw version, hit
CTRL-A to select all, then
CTRL-C to copy to clipboard.
- Return to the LibreOffice Macro editor, position your cursor under the “End Sub” line, then hit
CTRL-V to paste it in. Press
CTRL-S to save it.
- Close the Macro editor.
Now when you go to Tools > Macros > Organise macros > LibreOffice Basic… (and My Macros > Standard > Module 1) again, you will see
StraightQuotes2CurlyQuotes listed below
Main. Good. It worked!
2. Assign to Menu
You could just run the macro from Tools > Macros > Organise macros > LibreOffice Basic…, click on
StraightQuotes2CurlyQuotes, then click “Run” (the top button on the right). If you’re doing this infrequently, that’s probably good enough. If you think you might be using this more often, then it can be assigned to the menus by following these steps:
Customise > Menus, then choose the menu you want to add your macro to from the
- Click the
Add... button on the right of the dialog, and scroll to the bottom of the “Category” listing until you see
> LibreOffice Macros.
- Click (to open) on
My Macros > Standard > Module 1. You should now see
StraightQuotes2CurlyQuotes listed in the right-hand “Commands” box. Click on it to select it.
- Click the
Add button (which will add the macro to your chosen menu), then
Close, to close the “Add Commands” dialog.
- You can now use the ⇧ and ⇩ buttons to locate the “Straight2Curly” macro precisely where you want it in the menu. When finished, click
- You may need to close and re-open LibreOffice for your new entry to be visible in the menus.
‘...’ conversions are only a click away. Take ten minutes (or less!) to set this up, and your next conversions will be done almost instantly.