sd = oSheet.createSearchDescriptor()
sd.setSearchString("SearchString")
fc = oSheet.findFirst(sd)
while True :
if fc == None : break
fc.CellBackColor = 12341234
fc = oSheet.findNext(fc, sd)
7/02/2010
Searching a text in openoffice calc sheet using python code
Set optimal width for all columns of a sheet in openoffice calc with python script code
oSheet.Columns.OptimalWidth = True
.
.
set image size in openoffice calc with python code
1. resizing selected images
2. Resizing the first images (getByIndex(0)) in the selected sheet.
def ResizingSelectedImages(height = 10000, width = 8000):
oDoc = getReady()
cSelection = oDoc.getCurrentSelection()
for loopi in range(cSelection.Count) :
tmpImage = cSelection.getByIndex(loopi)
tmpSize = tmpImage.Size
tmpSize.Width = width
tmpSize.Height = height
tmpImage.setSize(tmpSize)
2. Resizing the first images (getByIndex(0)) in the selected sheet.
oSheet = oDoc.getSheets().getByIndex(0)
oDraw = oSheet.getDrawPage()
oImage = oDraw.getByIndex(0)
newSize = oImage.Size
newSize.Height = 20000
newSize.Width = 20000
oImage.setSize(newSize)
select (activate) a sheet in openoffice calc by python code
import uno
localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", localContext )
# note the port number is 8100, where the default value is 2002
ctx = resolver.resolve( "uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext" )
smgr = ctx.ServiceManager
desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
oDoc = desktop.getCurrentComponent()
# sheet to be activated
oSheet = oDoc.getSheets().getByIndex(2)
# activate the sheet
oController = oDoc.getCurrentController()
oController.setActiveSheet(oSheet)
# set first visible row
oController.setFirstVisibleRow(3)
7/01/2010
openoffice start option enable python macro
openoffice calc should be run with the command
or edit /usr/bin/ooffice (in ubuntu)
$ ooffice -calc --accept="socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"
or edit /usr/bin/ooffice (in ubuntu)
$ cat /usr/bin/ooffice
#!/bin/sh
/usr/lib/openoffice/program/soffice "$@" --accept="socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"
$
피드 구독하기:
글 (Atom)