![]() Since we using the UNO module we have to import what we need straight from the path. We also use nested modules from Text, AWT, and LANG. On this script we abandon the XSCRIPTCONTEXT and use the UNO module. G_exportedScripts = capitalisePython, TableSample.py Can be omitted, if # all functions shall be visible, however here getNewString shall be suppressed select (xTextRange ) # lists the scripts, that shall be visible inside OOo. NewString = getNewString ( theString ) if newString: NewString = getNewString (theString ) if newString : createTextCursorByRange (xTextRange ) if not xWordCursor. # sadly we can have a selection where nothing is selected # in this case we get the XWordCursor and make a selection! getByIndex (i ) #print "string: " + xTextRange.getString() getCurrentController ( ) #see section 7.5.1 of developers' guide getDocument ( ) #the writer controller impl supports the interface """Change the case of a selection, or current word from uppercase, to first char uppercase, to all lowercase to uppercase.""" # The context variable is of type XScriptContext and is available to # all BeanShell scripts executed by the Script Framework ![]() upper ( ) return newString def capitalisePython ( ): # first two chars are UC => first UC, rest LC isupper ( ) and len (theString ) >= 2 and theString. Return "" # should we tokenize on "."? if theString. If not theString or len (theString ) = 0 : # helper function def getNewString ( theString ) :
0 Comments
Leave a Reply. |