Reputation: 11
I'm working with OpenERP and a module named report_openoffice. This module needs the package python-uno installed. The problem is that i have 2 versions of python(2.6 and 2.7). When I install the package, Python2.7 can use the package python-uno but python2.6 can't. I need to use it in python2.6. Is there a way to install this package for python 2.6?
PS: I'm on Ubuntu 11.04
Thank you very much
Upvotes: 1
Views: 1358
Reputation: 11
uno
package install in python 2.7, then run following commands:
sudo apt-get install libreoffice python-genshi python-cairo python-lxml python-setuptools
sudo apt-get install libreoffice-script-provider-python
easy_install uno
Upvotes: -1
Reputation: 7684
python-uno is often used to drive OpenOffice/LibreOffice. However, if you just want to create reports in odt or pdf files, you can use PyQt4
A simple example to show how to write to an odt file:
>>>from pyqt4 import QtGui
# Create a document object
>>>doc = QtGui.QTextDocument()
# Create a cursor pointing to the beginning of the document
>>>cursor = QtGui.QTextCursor(doc)
# Insert some text
>>>cursor.insertText('Hello world')
# Create a writer to save the document
>>>writer = QtGui.QTextDocumentWriter()
>>>writer.supportedDocumentFormats()
[PyQt4.QtCore.QByteArray(b'HTML'), PyQt4.QtCore.QByteArray(b'ODF'), PyQt4.QtCore.QByteArray(b'plaintext')]
>>>odf_format = writer.supportedDocumentFormats()[1]
>>>writer.setFormat(odf_format)
>>>writer.setFileName('hello_world.odt')
>>>writer.write(doc) # Return True if successful
True
QTextCursor also can insert tables, frames, blocks, images. More information. More information at: http://qt-project.org/doc/qt-4.8/qtextcursor.html
Upvotes: 1
Reputation: 21
I soft linked the uno.py
and unohelper.py
from 2.7 into 2.6 and that seems to work.
As root do (or with sudo
):
$> cd /usr/lib/python2.6/dist-packages
$> ln -s /usr/lib/python2.7/dist-packages/uno.py
$> ln -s /usr/lib/python2.7/dist-packages/unohelper.py
Upvotes: 2