Skip to content

Instantly share code, notes, and snippets.

@Octagon-simon
Created December 26, 2025 23:02
Show Gist options
  • Select an option

  • Save Octagon-simon/df231e9827805fb8111b6686c7bb6971 to your computer and use it in GitHub Desktop.

Select an option

Save Octagon-simon/df231e9827805fb8111b6686c7bb6971 to your computer and use it in GitHub Desktop.
This script allows you to apply double spacing between words in LibreOffice. How to run? Tools → Macros → Organize Macros → LibreOffice Basic → New → DoubleSpaceWords. Then follow the same steps again, but this time click on Run and select the module you just created.
Sub DoubleSpacesBetweenWords
Dim oDoc As Object
Dim oReplace As Object
oDoc = ThisComponent
' Create a search descriptor
oReplace = oDoc.createSearchDescriptor()
' Search for a single space
oReplace.SearchString = " "
' Replace with double space
oReplace.ReplaceString = " "
' Do global replace
oReplace.SearchAll = True
' Execute replacement
oDoc.replaceAll(oReplace)
MsgBox "All spaces doubled!"
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment