solitamente, per alcune operazioni, uso selezionare un range di celle con questo sistema
Codice: Seleziona tutto
ThisComponent.CurrentController.select(oRange)
Grazie
Codice: Seleziona tutto
ThisComponent.CurrentController.select(oRange)
Codice: Seleziona tutto
def copy_clip(arg=None):
oDoc = XSCRIPTCONTEXT.getDocument()
oSheet = oDoc.CurrentController.ActiveSheet
ctx = XSCRIPTCONTEXT.getComponentContext()
desktop = XSCRIPTCONTEXT.getDesktop()
oFrame = desktop.getCurrentFrame()
dispatchHelper = ctx.ServiceManager.createInstanceWithContext( 'com.sun.star.frame.DispatchHelper', ctx )
dispatchHelper.executeDispatch(oFrame, ".uno:Copy", "", 0, list())
########################################################################
def paste_clip(arg=None):
oDoc = XSCRIPTCONTEXT.getDocument()
oSheet = oDoc.CurrentController.ActiveSheet
ctx = XSCRIPTCONTEXT.getComponentContext()
desktop = XSCRIPTCONTEXT.getDesktop()
oFrame = desktop.getCurrentFrame()
dispatchHelper = ctx.ServiceManager.createInstanceWithContext( 'com.sun.star.frame.DispatchHelper', ctx )
dispatchHelper.executeDispatch(oFrame, ".uno:Paste", "", 0, list())
oDoc.CurrentController.select(oDoc.createInstance("com.sun.star.sheet.SheetCellRanges")) #'unselect
Codice: Seleziona tutto
doc = XSCRIPTCONTEXT.getDocument()
ranges = doc.createInstance("com.sun.star.sheet.SheetCellRanges")
range1 = doc.Sheets.getCellRangeByPosition(0,0,0,9,0).RangeAddress # -> Foglio1.D1:A10
range2 = doc.Sheets.getCellRangeByPosition(3,0,3,9,0).RangeAddress # -> Foglio1.D1:A10
ranges.addRangeAddresses((range1, range2), True)
doc.CurrentController.select(ranges)