Python Macros's Not the Power in OOo they should be ?

F

flebber

I have recently been looking at openoffice because I saw it had
support to use python Macro's. I thought this would provide OOo with a
great advantage a fully powerful high level language as compared to
VBA in Excel.

I have found few docs on the subject.
http://wiki.services.openoffice.org/wiki/Python_as_a_macro_language
http://development.openoffice.org/
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Scripting/Scripting_Framework

Doesn't appear at the moment Python doesn't have the power in OOo it
should. Has anyone had much success with python macro's. Or developing
powerful macro's in an language?
 
F

flebber

I have recently been looking at openoffice because I saw it had
support to use python Macro's. I thought this would provide OOo with a
great advantage a fully powerful high level language as compared to
VBA in Excel.

I have found few docs on the subject.http://wiki.services.openoffice.org...noffice.org/wiki/Documentation/DevGuide/Scrip...

Doesn't appear at the moment Python doesn't have the power in OOo it
should. Has anyone had much success with python macro's. Or developing
powerful macro's in an language?

I sort of expected they might have had jpython or javascript version
of the excel VBA editor.
 
L

Lawrence D'Oliveiro

In message
flebber said:
Has anyone had much success with python macro's. Or developing powerful
macro's in an language?

I did an application for my own use recently, involving automatically
generating invoices in editable OOWriter format from my billing database. I
gave up on all the PyUNO stuff, and used ODFPY instead—so much easier to
generate ODF directly, without having to go through OpenOffice code.

And OpenOffice has been able to open the results for final tweaking just
fine.
 
T

Tim Harig

In message


I did an application for my own use recently, involving automatically
generating invoices in editable OOWriter format from my billing database. I
gave up on all the PyUNO stuff, and used ODFPY instead???so much easier to
generate ODF directly, without having to go through OpenOffice code.

Much agreed. The UNO architecture seems to have been rather mishandled.
While the general idea was nice, the implementation seems to be overly
complicated and poorly documented.

The ODF format itself is rather easy to figure out manipulate directly.
For those who do not know, the file is just a jar archive with the content
and style information all formatted as xml files. I will use the ODF
spreadsheet file as an example.

) 00:40,501$ ls demo.ods typescript
)
) 00:40,502$ /usr/lib64/java/bin/jar -xf demo.ods
)
) 00:40,503$ ls
) Configurations2 META-INF Thumbnails content.xml demo.ods
) meta.xml mimetype settings.xml styles.xml typescript
)
) 00:40,504$ xmlformat < content.xml | fmt
) <?xml version="1.0" encoding="UTF-8"?>
) <office:document-content
) xmlns:eek:ffice="urn:eek:asis:names:tc:eek:pendocument:xmlns:eek:ffice:1.0"
) xmlns:style="urn:eek:asis:names:tc:eek:pendocument:xmlns:style:1.0"
) xmlns:text="urn:eek:asis:names:tc:eek:pendocument:xmlns:text:1.0"
) xmlns:table="urn:eek:asis:names:tc:eek:pendocument:xmlns:table:1.0"
) xmlns:draw="urn:eek:asis:names:tc:eek:pendocument:xmlns:drawing:1.0"
) xmlns:fo="urn:eek:asis:names:tc:eek:pendocument:xmlns:xsl-fo-compatible:1.0"
) xmlns:xlink="http://www.w3.org/1999/xlink"
) xmlns:dc="http://purl.org/dc/elements/1.1/"
) xmlns:meta="urn:eek:asis:names:tc:eek:pendocument:xmlns:meta:1.0"
) xmlns:number="urn:eek:asis:names:tc:eek:pendocument:xmlns:datastyle:1.0"
) xmlns:presentation="urn:eek:asis:names:tc:eek:pendocument:xmlns:presentation:1.0"
) xmlns:svg="urn:eek:asis:names:tc:eek:pendocument:xmlns:svg-compatible:1.0"
) xmlns:chart="urn:eek:asis:names:tc:eek:pendocument:xmlns:chart:1.0"
) xmlns:dr3d="urn:eek:asis:names:tc:eek:pendocument:xmlns:dr3d:1.0"
) xmlns:math="http://www.w3.org/1998/Math/MathML"
) xmlns:form="urn:eek:asis:names:tc:eek:pendocument:xmlns:form:1.0"
) xmlns:script="urn:eek:asis:names:tc:eek:pendocument:xmlns:script:1.0"
) xmlns:eek:oo="http://openoffice.org/2004/office"
) xmlns:eek:oow="http://openoffice.org/2004/writer"
) xmlns:eek:ooc="http://openoffice.org/2004/calc"
) xmlns:dom="http://www.w3.org/2001/xml-events"
) xmlns:xforms="http://www.w3.org/2002/xforms"
) xmlns:xsd="http://www.w3.org/2001/XMLSchema"
) xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
) xmlns:rpt="http://openoffice.org/2005/report"
) xmlns:eek:f="urn:eek:asis:names:tc:eek:pendocument:xmlns:eek:f:1.2"
) xmlns:xhtml="http://www.w3.org/1999/xhtml"
) xmlns:grddl="http://www.w3.org/2003/g/data-view#"
) xmlns:field="urn:eek:penoffice:names:experimental:eek:oo-ms-interop:xmlns:field:1.0"
) office:version="1.2"
) grddl:transformation="http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl">
) <office:scripts/> <office:font-face-decls>
) <style:font-face style:name="Liberation Sans"
) svg:font-family="&apos;Liberation Sans&apos;"
) style:font-family-generic="swiss" style:font-pitch="variable"/>
) <style:font-face style:name="DejaVu Sans" svg:font-family="&apos;DejaVu
) Sans&apos;" style:font-family-generic="system"
) style:font-pitch="variable"/> <style:font-face style:name="Lohit
) Hindi" svg:font-family="&apos;Lohit Hindi&apos;"
) style:font-family-generic="system" style:font-pitch="variable"/>
) </office:font-face-decls> <office:automatic-styles>
) <style:style style:name="co1" style:family="table-column">
) <style:table-column-properties fo:break-before="auto"
) style:column-width="0.8925in"/>
) </style:style> <style:style style:name="ro1" style:family="table-row">
) <style:table-row-properties style:row-height="0.1681in"
) fo:break-before="auto" style:use-optimal-row-height="true"/>
) </style:style> <style:style style:name="ta1" style:family="table"
) style:master-page-name="Default">
) <style:table-properties table:display="true"
) style:writing-mode="lr-tb"/>
) </style:style> <style:style style:name="ta_extref" style:family="table">
) <style:table-properties table:display="false"/>
) </style:style>
) </office:automatic-styles> <office:body>
) <office:spreadsheet>
) <table:table table:name="Sheet1" table:style-name="ta1"
) table:print="false">
) <table:table-column table:style-name="co1"
) table:number-columns-repeated="4"
) table:default-cell-style-name="Default"/> <table:table-row
) table:style-name="ro1">
) <table:table-cell office:value-type="string">
) <text:p>This is cell A1</text:p>
) </table:table-cell> <table:table-cell
) table:number-columns-repeated="2" office:value-type="float"
) office:value="8">
) <text:p>8</text:p>
) </table:table-cell> <table:table-cell table:formula="of:=[.B1]*[.C1]"
) office:value-type="float" office:value="64">
) <text:p>64</text:p>
) </table:table-cell>
) </table:table-row>
) </table:table> <table:table table:name="Sheet2" table:style-name="ta1"
) table:print="false">
) <table:table-column table:style-name="co1"
) table:default-cell-style-name="Default"/> <table:table-row
) table:style-name="ro1">
) <table:table-cell/>
) </table:table-row>
) </table:table> <table:table table:name="Sheet3" table:style-name="ta1"
) table:print="false">
) <table:table-column table:style-name="co1"
) table:default-cell-style-name="Default"/> <table:table-row
) table:style-name="ro1">
) <table:table-cell/>
) </table:table-row>
) </table:table>
) </office:spreadsheet>
) </office:body>
) </office:document-content>
)
) 00:41,505$ exit
 
B

Boris Borcic

Lawrence said:
I did an application for my own use recently, involving automatically
generating invoices in editable OOWriter format from my billing database. I
gave up on all the PyUNO stuff, and used ODFPY instead—so much easier to
generate ODF directly, without having to go through OpenOffice code.

And OpenOffice has been able to open the results for final tweaking just
fine.

A nice package to manipulate Ooo text documents with python is the pod module of
the appy framework. It uses the same approach with a twist.
 
L

Lawrence D'Oliveiro

The UNO architecture seems to have been rather mishandled. While the
general idea was nice, the implementation seems to be overly complicated
and poorly documented.

For an example of a much nicer way of doing things, compare the Python
support in Blender: it’s a lot easier to get something simple working, and
there are loads of scripts already written by others that you can refer to.

Of course, they’ve completely reworked the scripting API in 2.5, but I think
that’s for the better.
 
J

John Pinner

A nice package to manipulate Ooo text documents with python is the pod module of
the appy framework. It uses the same approach with a twist.

One of our guys, David Chan, has done something you may find useful,
'OpenDocMill':

http://www.troi.org/opendoc-mill.html

We use it to produce some quite complicated documents, for example
Engineering Reports, Invoices, Certificates.

Best wishes,

John
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,169
Messages
2,570,920
Members
47,462
Latest member
ChanaLipsc

Latest Threads

Top