** Changed in: openobject-client
       Status: New => Confirmed

** Changed in: openobject-client
     Assignee: Anup (OpenERP) (ach-openerp) => (unassigned)

** Changed in: openobject-client
    Milestone: 6.0 => None

** Changed in: openobject-client
    Milestone: None => 6.0

** Changed in: openobject-client
     Assignee: (unassigned) => OpenERP sa GTK client R&D (openerp-dev-gtk)

-- 
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.

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/~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