This will start OpenOffice 3.
import os import subprocess import sys import time import uno NoConnectionException = uno.getClass("com.sun.star.connection.NoConnectException") ooffice = 'soffice "-accept=socket,host=localhost,port=8100;urp;"' def start_OOo(): '''Starts OpenOffice.org with a listening socket.''' # Start OpenOffice.org and report any errors that # occur. try: retcode = subprocess.call(ooffice, shell=True) if retcode < 0: print >>sys.stderr, \ "OOo was terminated by signal", \ -retcode elif retcode > 0: print >>sys.stderr, \ "OOo returned", \ retcode except OSError, e: print >>sys.stderr, "Execution failed:", e # Terminate this process when OOo has closed. raise SystemExit() started_OOo = False if not started_OOo: print "Starting OOo" started_OOo = True start_OOo() time.sleep(3) print "OOo started"
We can use now python scripts to create any type of file use by OpenOffice .
Let show one image create with few lines :