C'était bien évidemment la solution.
Merci
sub n_p
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(5) as new com.sun.star.beans.PropertyValue
rem -- remplacer \p\p par saut de ligne manuel --
args1(0).Name = "SearchItem.SearchString"
args1(0).Value = "\p\p"
args1(1).Name = "SearchItem.ReplaceString"
args1(1).Value = "\n"
dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args1())
rem -- remplacer \p par \s --
args1(2).Name = "SearchItem.SearchString"
args1(2).Value = "\p"
args1(3).Name = "SearchItem.ReplaceString"
args1(3).Value = " "
dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args1())
rem -- remplacer \n par \p --
args1(4).Name = "SearchItem.SearchString"
args1(4).Value = "\n"
args1(5).Name = "SearchItem.ReplaceString"
args1(5).Value = "\p"
dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args1())
end sub
Cordialement
Sandy-Pascal Andriant
Le 29/07/2018 à 14:28, Thierry Jeanneret a écrit :
Bonjour,
On peut vraiment exécuter plusieurs recherches-remplacements d'un seul
coup ? J'essaierais de faire l'executeDispatch à chaque jeu de
paramètres, mais je peux me tromper.
Thierry
Le dim. 29 juil. 2018 à 14:03, sandy andriant
<andriant.sa...@gmail.com <mailto:andriant.sa...@gmail.com>> a écrit :
Bonjour,
J'ai essayé de bricoler une macro mais elle ne fonctionne pas.
Pourriez-vous m'indiquer mes erreurs SVP ?
3 étapes dans un fichier .odt
1. remplacer 2 fins de paragraphe (\p\p) par un saut de ligne
manuel (\n)
2. remplacer 1 saut de ligne (\p) par une espace ( )
3. remplacer saut de ligne manuel (\n) par 1 fin de paragraphe (\p)
Merci
sub n_p
rem
----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem
----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem
----------------------------------------------------------------------
dim args1(5) as new com.sun.star.beans.PropertyValue
rem -- remplacer \p\p par saut de ligne manuel--
args1(0).Name = "SearchItem.SearchString"
args1(0).Value = "\p\p"
args1(1).Name = "SearchItem.ReplaceString"
args1(1).Value = "\n"
rem -- remplacer \p par \s --
args1(2).Name = "SearchItem.SearchString"
args1(2).Value = "\p"
args1(3).Name = "SearchItem.ReplaceString"
args1(3).Value = " "
rem -- remplacer \n par \p --
args1(4).Name = "SearchItem.SearchString"
args1(4).Value = "\n"
args1(5).Name = "SearchItem.ReplaceString"
args1(5).Value = "\p"
dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0,
args1())
end sub
--
Cordialement
Sandy-Pascal Andriant
--
Envoyez un mail à users+unsubscr...@fr.libreoffice.org
<mailto:users%2bunsubscr...@fr.libreoffice.org> pour vous désinscrire
Les archives de la liste sont disponibles à
https://listarchives.libreoffice.org/fr/users/
Privacy Policy: https://www.documentfoundation.org/privacy
--
Envoyez un mail à users+unsubscr...@fr.libreoffice.org pour vous désinscrire
Les archives de la liste sont disponibles à
https://listarchives.libreoffice.org/fr/users/
Privacy Policy: https://www.documentfoundation.org/privacy