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

Tim Harig usernet at ilthio.net
Thu Sep 23 01:58:59 EDT 2010


On 2010-09-23, Lawrence D'Oliveiro <ldo at geek-central.gen.new_zealand> wrote:
> In message
><4d76a2ad-bf85-472e-8c63-ef16f320a411 at t11g2000vbc.googlegroups.com>, flebber 
> wrote:
>
>> 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.

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:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
) xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
) xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
) xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
) xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
) xmlns:fo="urn:oasis:names:tc:opendocument: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:oasis:names:tc:opendocument:xmlns:meta:1.0"
) xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
) xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
) xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
) xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
) xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
) xmlns:math="http://www.w3.org/1998/Math/MathML"
) xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
) xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
) xmlns:ooo="http://openoffice.org/2004/office"
) xmlns:ooow="http://openoffice.org/2004/writer"
) xmlns:oooc="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:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2"
) xmlns:xhtml="http://www.w3.org/1999/xhtml"
) xmlns:grddl="http://www.w3.org/2003/g/data-view#"
) xmlns:field="urn:openoffice:names:experimental:ooo-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="'Liberation Sans'"
)   style:font-family-generic="swiss" style:font-pitch="variable"/>
)   <style:font-face style:name="DejaVu Sans" svg:font-family="'DejaVu
)   Sans'" style:font-family-generic="system"
)   style:font-pitch="variable"/> <style:font-face style:name="Lohit
)   Hindi" svg:font-family="'Lohit Hindi'"
)   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



More information about the Python-list mailing list