安装了python2.6和python2.7的Python uno包问题
我正在使用OpenERP和一个名为report\u openoffice的模块。此模块需要安装python uno包。问题是我有两个python版本(2.6和2.7)。当我安装这个包时,Python2.7可以使用pythonuo包,但是Python2.6不能。我需要在python2.6中使用它。有没有办法为Python2.6安装这个包 附言:我在Ubuntu 11.04上安装了python2.6和python2.7的Python uno包问题,python,openerp,uno,Python,Openerp,Uno,我正在使用OpenERP和一个名为report\u openoffice的模块。此模块需要安装python uno包。问题是我有两个python版本(2.6和2.7)。当我安装这个包时,Python2.7可以使用pythonuo包,但是Python2.6不能。我需要在python2.6中使用它。有没有办法为Python2.6安装这个包 附言:我在Ubuntu 11.04上 非常感谢我将uno.py和unoheloper.py从2.7软链接到2.6,这似乎很有效。 作为root do(或使用sud
非常感谢我将
uno.py
和unoheloper.py
从2.7软链接到2.6,这似乎很有效。
作为root do(或使用sudo
):
python uno通常用于驱动OpenOffice/LibreOffice。但是,如果您只想在odt或pdf文件中创建报告,则可以使用PyQt4 演示如何写入odt文件的简单示例:
>>>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还可以插入表、帧、块和图像。更多信息。更多信息,请访问:
uno
在python 2.7中安装软件包,然后运行以下命令:
sudo apt-get install libreoffice python-genshi python-cairo python-lxml python-setuptools
sudo apt-get install libreoffice-script-provider-python
easy_install uno
sudo apt-get install libreoffice python-genshi python-cairo python-lxml python-setuptools
sudo apt-get install libreoffice-script-provider-python
easy_install uno