Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello @bkpsusmitaa,

Perhaps you could use the following macro for that:

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( "$" )
    oReplace.setReplaceString( chr(10) )
    oReplace.SearchRegularExpression = True
    Writer_ReplaceAll_Paragraph_Breaks_With_Linefeeds = ThisComponent.replaceAll( oReplace )
End Function

Hello @bkpsusmitaa,

Perhaps you could use the following macro for that:

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( "$" )
    oReplace.setReplaceString( chr(10) )
    oReplace.SearchRegularExpression = True
    Writer_ReplaceAll_Paragraph_Breaks_With_Linefeeds = ThisComponent.replaceAll( oReplace )
End Function

EDIT 2017-07-31

In your function Writer_ReplaceAll_Blank_Paras() it seems that the "^" doesn't work properly... try replacing with:

bReplace.setSearchString( "\n\n" )
bReplace.setReplaceString( chr(10) )