REM ***** BASIC ***** Option Explicit Sub Main formater("%SO","Underline") 'soulignement formater("%GR","Bold") 'caracteres gras formater("%IT","Italic") 'italiques End sub sub formater (Balise, attribut) dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- ' retour au debut du document dispatcher.executeDispatch(document, ".uno:GoToStartOfDoc", "", 0, Array()) dim args1(2) as new com.sun.star.beans.PropertyValue args1(0).Name = "SearchItem.SearchString" ' recherche du fragment de texte debutant par la balise ' suivie de 0 ou plusieurs caracteres ' suivis par la balise args1(0).Value = Balise &".{0,}" &Balise ' recherche d'expressions regulieres args1(1).Name = "SearchItem.AlgorithmType" args1(1).Value = 1 args1(2).Name = "Quiet" args1(2).Value = true dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args1()) rem ---------------------------------------------------------------------- dim args2(0) as new com.sun.star.beans.PropertyValue args2(0).Name = attribut args2(0).Value = 1 dispatcher.executeDispatch(document, ".uno:"&attribut, "", 0, args2()) rem ---------------------------------------------------------------------- dim args3(2) as new com.sun.star.beans.PropertyValue args3(0).Name = "SearchItem.SearchString" args3(0).Value = Balise args3(1).Name = "SearchItem.Command" args3(1).Value = 3 args3(2).Name = "Quiet" args3(2).Value = true dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args3()) end sub