OOo2Tools
This product allows you to use a server instance of OpenOffice.org2 and gives you a simple way to build "macro" and to manage your documents. It has been used to build complex PDF documents from many MSWord documents with table of contents, using templates, etc.
Project Description
OpenOffice.org2 can started to listen on a port. On Linux with or without X, it can be used with PyUNO to make incredible stuff.
On linux: This tool detect if you have OpenOffice.org correctly installed, it give you some informations about it, it try to find a Python Interpreter that have UNO, and set all that information alone in the tool. If it doesn t find it, you can set this information by editing the portal_ooo2server. Once it s done, you can use it in your code as you can see on the screenshot.
The main difference with other OpenOffice.org Plone products is this one can uses a different Python interpreter to execute PyUNO scripts. This is necessary cause OpenOffice.org2 embeded is own Python, but on some Linux like Ubuntu , the Python who has UNO is the 2.4 or Zope runing on a 2.3. So got a problem at the begining of my project.
Furthermore, a system of "macros" has been developed to use it without knowing PyUNO (for common tasks). So an example here:
security.declarePrivate('openoffice_process')
def openoffice_process(self):
"""
"""
poo = getToolByName(self,'portal_ooo2server')
macro = poo.get_new_macro()
#the template need to be an ott file.
#using the search template fct (based on the name that need to be an .ott file
template = poo.get_template_byname('template-acte')
macro.add_open_cmd(document=template,name='template-acte')
macro.add_cmd('set_title','%s %s'%(self.Title(),self.getNumber()))
macro.add_cmd('set_pagestyle','MyOwnStyleInTheTemplate')
macro.add_cmd('insert_file',atfile=self,filename='a name for my file')
macro.add_cmd('set_pagestyle','MyOwnStyleInTheTemplate')
macro.add_save_to_cmd(name='my_txt',format='TEXT')
macro.add_save_to_cmd(name='my_html',format='HTML (StarWriter)')
macro.add_save_to_cmd(name='my_pdf',format='writer_pdf_Export')
poo.execute_macro(macro)
#indexed field:
txt_content = macro.get_content('my_txt')
self.setTextContent(txt_content)
#to display the word document
html_content = macro.get_content('my_html')
html_content = self.clean_html_picture(html_content)
self.setHtmlContent(html_content)
pdf_title = "%s.pdf"%self.Title()
macro.fs2atfile(fn=macro.get_file('my_pdf'),
atfile=self['MyATFileInstance'],
filename=pdf_title)
self['MyATFileInstance'].setTitle('An ATFile in PDF')
macro.delete_files()
TODO: try it on Windows and make it run.
Current Release
No stable release available yet.
If you are interested in getting the source code of this project, you can get it from the Code repository .
All Releases
| Version | Released | Description | Compatibility | Status |
|---|

