| View previous topic :: View next topic |
| Author |
Message |
jhnbk General User

Joined: 06 Nov 2006 Posts: 8
|
Posted: Sat Nov 11, 2006 11:56 am Post subject: python examples |
|
|
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 |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Sat Nov 11, 2006 12:13 pm Post subject: |
|
|
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 http://forum.openoffice.org |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
|
| Back to top |
|
 |
|