The earlier file I uploaded first.
The work I did:
to (1) replace the ¶ with ↲ for strings satisfying `[a-z,A-Z,0-9]$` and to (2) keep ¶ for strings satisfying `[.]¶`
The amended file after Alt-Search after find-replace operation, here.
After I have replaced the ¶ (paragraph marker) with ↲ (new line) with Alt-Search, I find that ↲ is immediately followed by an empty ¶. I also find that the character immediately preceding ¶ is also deleted.
But if I used `&\n` in Alt-search, the Replace option gives the following error message:
Code: Select all
BASIC runtime error.
An exception occurred
Type: com.sun.star.resource.MissingResourceException
Message: StringResourceImpl: No entry for ResourceID: \n.
and halts at the macro code `seznam.addItem(neco,0)` of `sub pridejDoSeznamuA(seznam, neco, promene, pevne)`
Strangely, if I want now to replace the created `^$` with no character in the `Replace` box,, Alt-Search can't find any empty paragraph!
In normal LibreOffice Find-Replace, I would have needed `&\n` but it would again be an addition of `$` (i.e., visually, ¶ addition).
Only the macro-code I was provided with does some justice but with an addition of `$` (i.e., visually, ¶ addition)!
What I want is this file:
If at all possible, will this indicated alteration to the original codes I was given, do?:
Code: Select all
rem *****************************************
Function Writer_ReplaceAll_Paragraph_Breaks_With_Linefeeds() As Long
REM Replaces all Paragraph breaks with a Linefeed character within the current Writer document.
REM Returns: the number of found/replaced occurrences.
Dim oReplace as Object
oReplace = ThisComponent.createReplaceDescriptor()
oReplace.setSearchString( "[a-z,A-Z,0-9]$" )
oReplace.setReplaceString( "&" + chr(10) )
oReplace.SearchRegularExpression = True
Writer_ReplaceAll_Paragraph_Breaks_With_Linefeeds = ThisComponent.replaceAll( oReplace )
REM Reiteration to remove empty paras after above action
Dim oDReplace as Object
oDReplace = ThisComponent.createReplaceDescriptor()
oDReplace.setSearchString( "^$" )
oDReplace.setReplaceString( "" )
oDReplace.SearchRegularExpression = True
Writer_ReplaceAll_Paragraph_Breaks_With_Linefeeds = ThisComponent.replaceAll( oDReplace )
End Function