OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

python examples

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
jhnbk
General User
General User


Joined: 06 Nov 2006
Posts: 8

PostPosted: Sat Nov 11, 2006 11:56 am    Post subject: python examples Reply with quote

where can I find examples of scripting with python and openoffice.
I'm specialy interested in working with formula object

I already wrote this piece of code, but is doesn't work
Code:

import uno

def insertformula():
    input = "1 over {x^2 cdot sqrt{1-x^2}}"
    text = doc.Text
    cursor = text.createTextCursor()
    formula=doc.createInstance("com.sun.star.text.TextEmbeddedObject")
    formula.EmbeddedObject.formula=input

g_exportedScripts=insertformula
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Sat Nov 11, 2006 12:13 pm    Post subject: Reply with quote

http://www.oooforum.org/forum/search.phtml
Search this site's Snippets-forum for python and user name DannyB.
Your function can not set variable doc.
ctx = uno.getComponentContext()
desktop = ctx.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", ctx)
doc = desktop.getCurrentComponent()
_________________
Rest in peace, oooforum.org
Get help on https://forum.openoffice.org
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Mon Nov 13, 2006 10:40 am    Post subject: Reply with quote

See also :
********** Python
a good documentation on Python can be found here : http://wiki.services.openoffice.org/wiki/Python
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group