Hi all,
Thanks to the wonderful help I received from Fernand and Christoph I have a
macro that takes a cell, emboldens the characters up to a fullstop and
leaves the remainder in normal weight. My own modest contribution was to
then remove the full stop so a cell like abcd.ef is converted to abcdef
where only abcd is in bold. Here is the code.
Sub EnBold
Dim oDoc As Object, oSheet As Object, oCell As Object
Dim CellCont as object, oTextCursor as Object
Dim Position as Integer
oDoc=ThisComponent
oSheet=oDoc.Sheets.getByName("Sheet1")
oCell=oSheet.getCellByposition(0,0) 'A1
Position = InStr(oCell.getString(), ".")
oTextCursor = oCell.createTextCursor()
oTextCursor.gotoStart(false)
oTextCursor.goRight(Position - 1, true)
oTextCursor.setPropertyValue("CharWeight", 150)
oTextCursor.goRight(1, true)
oTextCursor.goLeft(1, true)
oTextCursor.setString("")
End Sub
My contribution is the last 3 lines before End Sub. I'm not really confident
about how to use the cursor but moving 1 character to the right and then
changing directions and moving back one character to the left seems to have
the effect of highlighting the fullstop which can then be replaced by the
null string "". I'm not quite sure about the "true" and "false" in this and
I'm wondering if what I did is the correct method (it does work) or if
there is a simpler way of doing it.
As always, thanks in advance for the help.
Cheers,
Jonathan
--
Registerd Linux user #445917 at http://counter.li.org/
Please do not send me copies of list mail. I read the lists. Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]