3 messages in org.openoffice.fr.progRe: [prog] un HelloWorld en python ?
FromSent OnAttachments
Axel RousseauMar 12, 2007 8:54 am 
Laurent GodardMar 12, 2007 9:10 am 
Bernard MarcellyMar 12, 2007 10:21 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [prog] un HelloWorld en python ?Actions...
From:Laurent Godard (lgod@indesko.com)
Date:Mar 12, 2007 9:10:29 am
List:org.openoffice.fr.prog

Bonjour

il y a un HelloWorld dans C:\program files

voici sous linux, mais c'est la meme chose

$ cat /opt/openoffice.org2.1/share/Scripts/python/HelloWorld.py # HelloWorld python script for the scripting framework

def HelloWorldPython( ): """Prints the string 'Hello World(in Python)' into the current document""" #get the doc from the scripting context which is made available to all scripts model = XSCRIPTCONTEXT.getDocument() #get the XText interface text = model.Text #create an XTextRange at the end of the document tRange = text.End #and set the string tRange.String = "Hello World (in Python)" return None

J'essaye de faire ma premiere macro en python, mais je suis un peu bloqué. J'ai créé un fichier dans le repertoire utilisateur (Application Mais quand je vais dans "gérer les macros", je vois bien mon fichier, mais je ne vois pas en dessous ma méthode. Faut il déclarer les méthodes quelques parts ? y'a t'il certaines régles à suivre ?

tu n'as pas de return None (je ne sais pas si ca joue)

essaye egalement de deplacer ta macro python dans share plutot que user pour voir

Laurent