Bonjour,
Plusieurs collègues m’ont déjà demandé comment faire pour mettre en exposant les caractères après les nombres, pour faire comme ceci :
1er, 2ème, 3ème, 2nd, 2nde
1ère solution
C’est la méthode classique, vous tapez votre texte, vous sélectionnez votre texte à mettre en exposant, puis vous allez dans FORMAT >> CARACTÈRES, onglet POSITION et vous cochez « EXPOSANT »
2ème solution
Cette solution est très rapide, car c’est un raccourci clavier. La commande est :
Ctrl + Maj + p
3ème solution
La dernière solution est une macro que j’ai modifiée. Vous pouvez le faire également vous-même. Vous créez une nouvelle macro et vous collez dedans, le code suivant :
'********************************************************************************
'Copyright (C) 2003 Laurent Godard
'dev.godard@wanadoo.fr
'********************************************************************************
'version 2
'Copyright (C) 2012 Sylvain DENIS
'contact@denis-sylvain.be
'********************************************************************************
'This library is free software; you can redistribute it and/or
'modify it under the terms of the GNU Lesser General Public
'License as published by the Free Software Foundation; either
'version 2.1 of the License, or (at your option) any later version.
'This library is distributed in the hope that it will be useful,
'but WITHOUT ANY WARRANTY; without even the implied warranty of
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
'Lesser General Public License for more details.
'http://www.opensource.org/licenses/lgpl-license.php
'You should have received a copy of the GNU Lesser General Public
'License along with this library; if not, write to the Free Software
'Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'******************************************************************************
Sub PasseEnExposant()
Dim oSearch As Object
'Liste des exposants à traiter. Si ajout ou suppression modifier le "Dim" et mettre le nombre correspondant au nombre d'exposants
Dim ListeExposants(1 to 5)
ListeExposants(1)="er"
ListeExposants(2)="ère"
ListeExposants(3)="ème"
ListeExposants(4)="nde"
ListeExposants(5)="nd"
ThisComponent.lockControllers
'Fait une boucle sur les différents cas
For IndxExpo=1 to ubound(ListeExposants())
oSearch = ThisComponent.createSearchDescriptor
oSearch.SearchString ="[0123456789]"+ListeExposants(IndxExpo)
oSearch.searchCaseSensitive=true
oSearch.SearchRegularExpression=true
oSearch.SearchWords=true
trouve=ThisComponent.findFirst(oSearch)
While Not IsNull(trouve)
'sélectionne tous les caractères après le premier qui suit le chiffre (de 0 à 9)
trouve.gotoend(false)
trouve.goleft(len(ListeExposants(IndxExpo)),true)
'Réduit la taille %
trouve.CharEscapementHeight = 58
'Positionne verticalement %
trouve.CharEscapement=33
'Passe au suivant
trouve = ThisComponent.findNext(trouve.End, oSearch)
Wend
next IndxExpo
ThisComponent.UnlockControllers
end sub
Il ne vous restera plus qu’à créer un bouton dans votre barre d’outils préférée.
Si vous avez des remarques, n’hésitez pas à m’en faire part
Cela fonctionne aussi sur OOo4Kids et OOoLight.