PyOpenOffice 0.4 -
The Document Tool (final Version)
The Usability of
OpenOffice.org meeting the Power of XML Reporting Technologies -
without installing OOo on your server
Caution: For time reasons I
had to stop the development of this library. I am not able to give
support anymore - sorry. For questions please consult the PyOpenOffice
User Guide (see below) and the source code.
back to the main page
of the author
Have a look at a
reference implementation using PyOpenOffice: "Bezirksreiter" -
open source software for church administration (member and donation
tracking, accounting, reporting and statistics). Sorry - it's only
available in German (who will help to port it to other languages?).
Login as "Benutzername" = "Onkel_Otto" and "Passwort" = "12345".
This tool is
dedicated to the developers of OpenOffice.org, Python, the Reportlab Toolkit,
the Python
Imaging Library and trml2pdf
/ trml2html. They did a great job and I admire them for their
programming skills.
FAQ:
What is
PyOpenOffice?
- It is an XML based reporting tool, using OpenOffice.org as an
easy to use template generator
- It is a class library, written in the Python Language.
- It is a platform-independent command-line utility (most abilities
of the commandline interface are still missing)
Will PyOpenOffice
support the OpenDocument format of OpenOffice.org 2.0?
- Yes and no: as
far as I can see the SXW-to-SXW transformations also work with ODT
files without any modification
- All PDF
operations only work from SXW templates
- From my
experience I consider OpenOffice 2.0 still being too buggy to use it in
production environments (sorry!) - better you use the last stable
version of OOo 1.1
- At the
moment I do not have enough time to port the code. Interested hackers
should have a look at the "Normalizing" procedures and the XSLT
stylesheet.
What can
PyOpenOffice do for you? Here some examples:
- Make serial letters, lists and reports from templates in the
SXW-Format
and store them anew as SXW-Files
- Replace pictures - generate catalogues, worksheets, photo
galleries etc. from an SXW-Template.
- Extract the pure text information from the SXW-Document and store
it in a plain text file or a PDF-File
- Transform SXW-Files to PDF-Files
without installing OO - for example on a webserver
- Use OOo as template generator and transform SXW files to RML
(Report Markup Language) files
- Make serial letters, lists and reports from templates in the
RML format and transform them to PDF / HTML
- Replace pictures - generate catalogues, worksheets, photo
galleries etc. from an RML template and transform them to PDF / HTML
At what stage of
development is PyOpenOffice now?
- It is an Beta Release. Nevertheless many parts of it are a
"spin-off" product of my software "Bezirksreiter" for church
administration - which is considered to be stable now.
What license has
PyOpenOffice?
- It is distributed under the Lesser GNU Public License
What software is
required?
- Any operating
system that supports the following software:
- Python 2.3
(maybe it works form 2.1 upwards, but this is not recommended) for the
SXW-Processing
- The
ReportlabToolkit and the Python Imaging Library for the transformation
from SXW to PDF
- Any W3C conformant XSLT processor (for the new XML based features)
- OpenOffice.org
for viewing and editing the templates
- The PyOpenOffice-Zip-Package
- To get the
latest (unstable) version browse the CVS
tree on SourceForge.
- The last version (0.31) without XSLT support you find here
What are the
principles behind PyOpenOffice?
- Unpacking and Re-Packing of the SXW-Archive-File is done by the
Python zipfile Module
- Serial letters and reports are processed by using Regular
Expressions and string extract and replace operations
- Generating PDF is performed using the XML-SAX-Parser from the
Python Standard Library, the ReportlabToolkit and the Python Imaging
Library
- For some purposes an XML-DOM-API is used (Minidom from the Python
Standard Library)
- Plain text extract uses the SAX-Parser
- Generating RML additionally uses an XSLT processor
- PDF / HTML export with enhanced features now uses "tiny" rml2pdf
/ rml2html
- Read the sources and use pydoc from the Standard Library! But:
Too many functions and comments are still in German - sorry
Usage
- Unzip PyOpenOffice.zip into your path
- Make sure that all skripts have write access to this path
- Write your skript and import pyopenoffice. Mind: there are still
global variables in use, so you always have to use the whole module
Documentation
Restrictions and
Known Bugs
- PDF transformation: PyOpenOffice is
intentionally not a WYSIWYG tool! The transforming to PDF is
very
simple compared with the built-in function of OO - but have you ever
tried to install OO on a webserver to deliver PDF's? You need an
X-Server or a VNC-Server, vast amount of harddisk space - and you need
the approval by your webhoster... But, just try it out: I think
nevertheless the PDFs do not look
too bad.
Release History
- 0.403 (final): Bugfixes
for: Serial letter many file output - Usage with other XSLT processors
than libxslt/xsltproc - command line usage.
- 0.402: More
bugfixes for the new XML based approach.
- 0.401: Bugfixes
for the OO-to-RML stylesheet.
- 0.4: integration
of an entire new, more XML based approach using Report Markup Language
(RML) and XSLT: enhanced
flexibility, better PDF's etc. Read more about this in the new PyOpenOffice User Guide. Ability to
work with RML templates (similar to XSL-FO, but easier to
use and more powerful) - use OOo as template generator. Several
bugfixes.
- 0.31: new
class persistentDict for the history and cleanup function (the shelve
module was not always reliable). Use data with carriage returns in it
(for example from a database) and make them printable in SXW or PDF -
read the docstring of makeSerialLetters. Several bugfixes.
- 0.3 :
Generate PDF with arbitrary page sizes (Letter, DIN A5, portrait or
landscape etc.) and arbitrary text margins: page sizes and text
margins are now taken exactly from the SXW-Template by using an
XML-DOM-API (more functions using this API will follow in the next
versions). PyOpenOffice now comes with two modules: pyopenoffice.py
(main module) and textutilities_pyopenoffice (helper classes and
functions).
- 0.23
Tables with different column widths now can be mapped to PDF (have a
look at test.sxw). History and cleanup functions for the temporary
files
generated by PyOpenOffice.
- 0.22
Bugfixes for makeSerialLetters(): Multi:TFA-...-TFE rows do not have to
be the last row of this table anymore. You may now provide sourcefiles
that are not in the directory of pyopenoffice.py (in earlier releases
PyOpenOffice stopped with an error). New feature for
makeSerialLetters(): provide a preprocessed content.xml to the variable
"content" (read the docstrings).
- 0.21
Coloured background for paragraphs and table cells in PDF. User-defined
constants possible for makeSerialLetters() - not only "today" or
"heute"
allowed. Better explanations in test.sxw.
- 0.2 New
function to replace pictures. Patch for makeSerialLetters() to make it
usable with Asian fonts. Mind: no PDF
support for such fonts yet.
- 0.13
Bugfix for transforming tables to PDF: tables with headers are allowed
now in the SXW-Template. Support for special signs like the Euro-Symbol
by changing from Latin-1 to cp1252-transformation.
- 0.12
Bugfix for the makeSerialLetters()-function. Better test.sxw to explain
this function.
- 0.11
Bugfix for Windows XP, test.sxw adapted for English language users
back to the main page
of the author