My favorites | Sign in
Project Logo
                
People details
Project owners:
  gilles.lenfant
Project committers:
kevin.deldycke, hltbra

About

openxmllib provides resources to handle OpenXML documents from Python.

OpenXML is the new office document format supported natively by MS Office 2007, and as import/export format by Apple iWork'08 and OpenOffice 2.2.

OpenXML is defined in the ECMA-376 standard.

openxmllib runs on any platform that supports Python 2.4, 2.5 or 2.6 and the lxml Python library.

New with openxmllib 1.0.5

See more details here.

Features

Requirements

openxmllib requires the lxml 1.3.x or later library. See how to install it in lxml site.

Installation (from tarball)

Get the tarball with your browser, wget, curl or whatever, then:

  $ tar xfz openxmllib-x.y.y.tar.gz
  $ cd openxmllib-x.y.z
  $ sudo python setup.py install

Installation from Cheeseshop

Even easier that the tarball:

  $ [sudo] easy_install openxmllib

Note that this will install or upgrade a suited lxml library if you've not already go it.

Usage

  >>> import openxmllib
  >>> doc = openxmllib.openXmlDocument('office.docx')
  >>> # Raises a ValueError on not supported office files.
  >>> doc.mimeType
  'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
  >>> doc.coreProperties # Keys may depend on application
  {'title': u'blah...', u'creator': u'John Doe', ...}
  >>> doc.extendedProperties # Keys may depend on application
  {'Words': u'312', 'Application': u'Your favorite word processor', ...}
  >>> doc.customProperties # May return an empty mapping
  {'My property': u'My value', ...}
  >>> doc.allProperties # Merges core+extended+custom properties (see above)
  {...}
  >>> doc.indexableText(include_properties=False)
  u'all the words of that document body'
  >>> doc.indexableText(include_properties=True)
  u'all the words of that document body and all properties values'

Console tool

openxmllib comes with a shell command for testing of for use from a non Python app:

  $ openxmlinfo.py --help

Planned features









Hosted by Google Code