merci j'essai tout de suite...
De : yves dutrieux <[email protected]> À : [email protected] Sujet : Re: [fr-users] macro Date : 11/11/2018 19:09:52 CET Copie à : Thierry Jeanneret <[email protected]>; users LibreOffice LO <[email protected]> Bonjour, tu dois insérer ton texte APRES l'affectation de tes propriétés (voici le code corrigé) : sub insert_text 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 ---------------------------------------------------------------------- rem dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", 0, Array()) rem ---------------------------------------------------------------------- dim args4(0) as new com.sun.star.beans.PropertyValue args4(0).Name = "Bold" args4(0).Value = true dispatcher.executeDispatch(document, ".uno:Bold", "", 0, args4()) rem ---------------------------------------------------------------------- dim args5(0) as new com.sun.star.beans.PropertyValue args5(0).Name = "Color" args5(0).Value = 255 dispatcher.executeDispatch(document, ".uno:Color", "", 0, args5()) rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = " " dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- dim args2(1) as new com.sun.star.beans.PropertyValue args2(0).Name = "Symbols" args2(0).Value = "†" args2(1).Name = "FontName" args2(1).Value = "Liberation Serif" dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", 0, args2()) end sub Yves Le dim. 11 nov. 2018 à 18:31, Gilles Massardier <[email protected]> a écrit : cela me semble une bonne raison, par contre comment faire pour que le caractère spéciale soit sélectionné??? Je n'y connais rien en programmation de macro (et je n'ai pas le loisir de m'y mettre malheureusement)... Le 11/11/2018 à 18:26, Thierry Jeanneret a écrit : > Bonsoir, > > A priori je dirais que lorsque vous mettez l'attribut Bold ou la > couleur rien n'est sélectionné. Mais ce n'est qu'une hypothèse. > > Thierry > > > > Le dim. 11 nov. 2018 à 17:22, <[email protected] > <mailto:[email protected]>> a écrit : > > Bonjour > > Voici une nouvelle question envoyée à l'aide du formulaire de > demande d'aide > (http://fr.libreoffice.org/get-help/poser-une-question/). > Si vous répondez, merci de penser à utiliser la fonction "répondre > à tous" de votre logiciel de courrier électronique de façon que le > demandeur reçoive une copie de votre réponse. > > > Email:: [email protected] > <mailto:[email protected]> > Sujet:: macro > OS:: Linux > Version:: 6.1.x > Question:: J'ai enregistré une macro : > insertion d'un caractère spécial puis mise en gras et mise en > couleur... mais quand j'exécute la macro, l'insertion du caractère > se fait mais pas la mise en forme. Pourtant dans la macro > l'ensemble des demandes est enregistré... > > voici la macro en question... > > sub Main > 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(0) as new com.sun.star.beans.PropertyValue > args1(0).Name = "Text" > args1(0).Value = " " > > dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, > args1()) > > rem > ---------------------------------------------------------------------- > dim args2(1) as new com.sun.star.beans.PropertyValue > args2(0).Name = "Symbols" > args2(0).Value = "†" > args2(1).Name = "FontName" > args2(1).Value = "Liberation Serif" > > dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", 0, > args2()) > > rem > ---------------------------------------------------------------------- > rem dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", > 0, Array()) > > rem > ---------------------------------------------------------------------- > dim args4(0) as new com.sun.star.beans.PropertyValue > args4(0).Name = "Bold" > args4(0).Value = true > > dispatcher.executeDispatch(document, ".uno:Bold", "", 0, args4()) > > rem > ---------------------------------------------------------------------- > dim args5(0) as new com.sun.star.beans.PropertyValue > args5(0).Name = "Color" > args5(0).Value = 255 > > dispatcher.executeDispatch(document, ".uno:Color", "", 0, args5()) > > > end sub > > quelqu'un sait-il ou est le problème??? > > merci > > Gilles > > > -- > Envoyez un mail à [email protected] > <mailto:users%[email protected]> 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 à [email protected] pour vous désinscrire Les archives de la liste sont disponibles à https://listarchives.libreoffice.org/fr/users/ Privacy Policy: https://www.documentfoundation.org/privacy -- web site : http://www.molenbaix.com -- Envoyez un mail à [email protected] pour vous désinscrire Les archives de la liste sont disponibles à https://listarchives.libreoffice.org/fr/users/ Privacy Policy: https://www.documentfoundation.org/privacy
