Date: prev next · Thread: first prev next last
2018 Archives by date, by thread · List index


Eh bien ça marche très bien comme ça, vu le nombre de fois ou j'aurai besoin de cette macro, je vais gagner au moin une heure de boulot... Merci

Le 11/11/2018 à 19:12, Gilles Massardier a écrit :
merci j'essai tout de suite...


De : yves dutrieux <ydutrieux@gmail.com>
À : gilles.massardier@net-c.com
Sujet : Re: [fr-users] macro
Date : 11/11/2018 19:09:52 CET
Copie à : Thierry Jeanneret <thierry.jeanneret@gmail.com>;
    users LibreOffice LO <users@fr.libreoffice.org>

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 <gilles.massardier@net-c.com> 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, <demande_aide_fr@libreoffice.org
<mailto:demande_aide_fr@libreoffice.org>> 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:: gilles.massardier@net-c.com
      <mailto:gilles.massardier@net-c.com>
      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 à users+unsubscribe@fr.libreoffice.org
      <mailto:users%2Bunsubscribe@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+unsubscribe@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

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.