PyUno - CSV Opening With Writer

Joel Madero jmadero.dev at gmail.com
Fri Jan 18 07:05:33 PST 2013


Hi All,

I wanted to get some help trying to get pyuno to behave. Trying to 
automate our stats with pyuno :) The csv file opens with write no matter 
what I do to try to get it to open with spreadsheet. Thanks all.

import uno

# get the uno component context from the PyUNO runtime
localContext = uno.getComponentContext()

# create the UnoUrlResolver
resolver = localContext.ServiceManager.createInstanceWithContext(
                             "com.sun.star.bridge.UnoUrlResolver", 
localContext)

# connect to the running office
ctx = 
resolver.resolve("uno:pipe,name=pypipe;urp;StarOffice.ComponentContext")
smgr = ctx.ServiceManager



# get the central desktop object
DESKTOP =smgr.createInstanceWithContext("com.sun.star.frame.Desktop", ctx)

#The calling it's not exactly this way, just to simplify the code
DESKTOP.loadComponentFromURL('/data/Joel_Documents/Work/Non-Profit/Libre-Office/FDOBugs/PerDay/2013_01_15.csv',"_blank",0,(),FilterName="Text 
- txt - csv 
(StarCalc)",DocumentService="com.sun.star.sheet.SpreadsheetDocument")

Best Regards,
Joel





More information about the LibreOffice mailing list