Please have a look at bug 677205 too.
Thanks.

-- 
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 C2C
OERPScenario, which is subscribed to the OpenERP Project Group.

Status in OpenObject GTK Client: Confirmed

Bug description:
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 !'),'')



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

Reply via email to