You have been assigned a bug task for a public bug by Olivier Dony (OpenERP) 
(odo):

Hi!
I've implemented data export to OpenOffice.org Calc and I share the code here, 
maybe others need this functionality, too. It does the same job as the 'Open in 
Excel' function for win32. This code was tested on Ubuntu 8.04 and 9.04.
The needed oootools.py is attached.

So replace this line: :)
common.message(_("Function only available for MS Office !\nSorry, OOo users 
:("))

with this:
        try:
            import subprocess
            import time
            retcode = subprocess.call(["soffice", 
"-accept=socket,host=localhost,port=2002;urp;", "-nodefault"], shell=False)
            from oootools import OOoTools
            for i in range(10):
                ooo = OOoTools('localhost', 2002)
                if ooo and ooo.desktop:
                    break
                time.sleep(1)
            doc = 
ooo.desktop.loadComponentFromURL("private:factory/scalc",'_blank',0,())
            sheet = doc.CurrentController.ActiveSheet
            for col in range(len(fields)):
                cell = sheet.getCellByPosition(col, 0)
                cell.String = fields[col]
            cellrange = sheet.getCellRangeByPosition(0, 1, len(fields) - 1, 
len(result))
            tresult = []
            for i in range(len(result)):
                tresult.append(tuple(result[i]))
            tresult = tuple(tresult)
            cellrange.setDataArray(tresult)
        except:
            common.error(_('Error Opening Excel !'),'')

** Affects: openobject-client
     Importance: Wishlist
     Assignee: OpenERP sa GTK client R&D (openerp-dev-gtk)
         Status: Confirmed

-- 
Implemented data export to OO Calc (code included)
https://bugs.launchpad.net/bugs/399278
You received this bug notification because you are a member of OpenERP sa GTK 
client R&D, which is a bug assignee.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to