

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
2 messages in org.openoffice.fr.progRe: [prog] fusionner des cellules calc| From | Sent On | Attachments |
|---|---|---|
| zorglub.1er | Jul 8, 2007 5:40 am | |
| Francois Gatto | Jul 8, 2007 9:54 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [prog] fusionner des cellules calc | Actions... |
|---|---|---|
| From: | Francois Gatto (oo...@volcar.org) | |
| Date: | Jul 8, 2007 9:54:33 pm | |
| List: | org.openoffice.fr.prog | |
zorglub.1er a écrit :
Bonjour ;0)
D'abord merci pour votre attention et votre engagement dans cette liste :0)
REM equivalence com.sun.star.table.CellHoriJustify.CENTER oRange.HoriJustify = 2
Cela fonctionne.
Toutefois, quand je cherche dans l'aide d'OpenOffice.org je ne trouve ni la propriété CellHoriJustify ni la propriété merge.
http://api.openoffice.org/docs/common/ref/com/sun/star/util/XMergeable.html#merge
D'ailleurs, comment sais tu que pour CellHoriJustify on utilise les chiffres 1, 2, 3 et non left, center, right quand cette propriété est utilisée sans l'usage de com.sun.star.table. ?
Un bon moyen d'en apprendre un peu plus pour manipuler OOo via des macros est d'utiliser l'excellent outils Xray
Ainsi, pour HoriJustify tu obtiendras cette information :
http://www.cijoint.fr/cij97272337418937.png
qui précise qu'une valeur Integer est utilisée.
En faisant quelques tests on finit par en retirer des éléments d'informations utiles ;)
Xray est disponible ici (merci Bernard Marcelly) : http://fr.openoffice.org/Documentation/How-to/Basic/XrayTool_fr.sxw
En effet, il n'est pas mentionné dans cette page ci-desous que les chiffres doivent être utilisés dans ce cas.
http://api.openoffice.org/docs/common/ref/com/sun/star/table/CellHoriJustify.html
L'emploi des valeurs numériques n'est pas recommandée, ainsi que l'a rappelé Laurent Godard dans ce dernier message : http://fr.openoffice.org/servlets/ReadMsg?list=prog&msgNo=5965
Il est nettement préférable d'utiliser les constantes alpha.
Mais parfois il pourra être nécessaire d'en récupérer le correspondant numérique :
http://ooo.developpez.com/faq/?page=Automation#Question174
Ainsi, je ne sais pas comment trouver (et comment chercher) que c'est les chiffres 1, 2, 3 qu'il faut utiliser dans le cas de CellHoriJustify sans com.sun.star.table.
Voici une macro fonctionelle usant de ces deux propriétés sans com.sun.star
--------------------------------------
REM ***** BASIC *****
Sub ExempleFusion
thisComponent.Sheets.getByName("Feuille1").getCellRangeByName("d2").String = "OUILLE" thisComponent.Sheets.getByName("Feuille1").getCellRangeByName("d2:e2").merge(true) thisComponent.Sheets.getByName("Feuille1").getCellRangeByName("d2:e2").HoriJustify=3
thisComponent.Sheets.getByName("Feuille1").getCellByPosition(1,0).String = "quatre" thisComponent.Sheets.getByName("Feuille1").getCellRangeByPosition(1,0, 6,0).merge(true) thisComponent.Sheets.getByName("Feuille1").getCellRangeByPosition(1,0, 6,0).HoriJustify=2
thisComponent.Sheets.getByName("Feuille1").getCellByPosition(3, 1).String = "KIKO" thisComponent.Sheets.getByName("Feuille1").getCellRangeByPosition(3,1, 4,1).merge(true) thisComponent.Sheets.getByName("Feuille1").getCellRangeByPosition(3,1, 4,1).HoriJustify=2
End Sub
-----------------------------------
Mais quel est le but de la question ? Quel est l'interet escompté ?
Comme je ne comprends pas ce qu'est "com.sun.star.table", ni son usage (je ne sais pas m'en servir), j'essaye de faire des macros sans "com.sun.star.table"
En effet, étant débutant dans l'apprentissage des macros l'usage de "com.sun.star.table" ne m'est pas évident.
Merci d'avance ;0)
La programmation "avancée" requiert de l'expérience, aussi il faut prendre le temps de se documenter (les sources d'informations sont nombreuses) , puis de tester.
Je t'invite dans un premier temps à lire ces documents:
http://docs.sun.com/app/docs/doc/819-1328?l=fr (en ligne) http://docs.sun.com/app/docs/doc/819-1328?l=fr&a=load (téléchargement)
http://www.eyrolles.com/Informatique/Livre/9782212117639/livre-programmation-openoffice-org-2.php ouvrage d'excellente qualité à lire et relire ;)
Francois Gatto







