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

2010-09-23 Thread Tim Harig
On 2010-09-23, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote:
 In message
4d76a2ad-bf85-472e-8c63-ef16f320a...@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=apos;Liberation Sansapos;
)   style:font-family-generic=swiss style:font-pitch=variable/
)   style:font-face style:name=DejaVu Sans svg:font-family=apos;DejaVu
)   Sansapos; style:font-family-generic=system
)   style:font-pitch=variable/ style:font-face style:name=Lohit
)   Hindi svg:font-family=apos;Lohit Hindiapos;
)   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:pThis is cell A1/text:p
)  /table:table-cell table:table-cell
)  table:number-columns-repeated=2 office:value-type=float
)  office:value=8
)   text:p8/text:p
)  /table:table-cell table:table-cell table:formula=of:=[.B1]*[.C1]
)  office:value-type=float office:value=64
)   text:p64/text:p
)  /table:table-cell
) 

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

2010-09-23 Thread Boris Borcic

Lawrence D'Oliveiro wrote:

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.

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.



--
http://mail.python.org/mailman/listinfo/python-list


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

2010-09-23 Thread Lawrence D'Oliveiro
In message i7eqb3$tg...@speranza.aioe.org, Tim Harig wrote:

 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.
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2010-09-23 Thread John Pinner
On Sep 23, 10:12 am, Boris Borcic bbor...@gmail.com wrote:
 Lawrence D'Oliveiro wrote:
  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.

  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.

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
--
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2010-09-22 Thread 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?

-- 
http://mail.python.org/mailman/listinfo/python-list


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

2010-09-22 Thread flebber
On Sep 23, 10:41 am, flebber flebber.c...@gmail.com wrote:
 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_languagehttp://development.openoffice.org/http://wiki.services.openoffice.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.
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2010-09-22 Thread Lawrence D'Oliveiro
In message
4d76a2ad-bf85-472e-8c63-ef16f320a...@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.

And OpenOffice has been able to open the results for final tweaking just 
fine.
-- 
http://mail.python.org/mailman/listinfo/python-list