Fernand Vanrie wrote:

> Jonathan Kaye wrote:
>> Hi again,
>> I'm now trying to get my head around how objects work in macros. I'm
>> trying to write a subroutine that will take the contents of a cell and
>> embolden the text up to a fullstop and leave the rest of the string
>> unchanged. Borrowing shamelessly from Andrew's excellent manual I've
>> managed to get this far:
>> Sub SetBold
>>   Dim oDoc As Object, oSheet As Object, oCell As Object
>>   Dim myselection as object
>>   Dim Position as Integer
>>   oDoc=ThisComponent
>>   oSheet=oDoc.Sheets.getByName("Sheet1")
>>   oCell=oSheet.getCellByposition(0,0) 'A1
>>    Position = InStr(oCell.getString(), ".") 'This works
>>    Print Mid(oCell.getString(), 1, Position - 1) 'This works too
>>    myselection = oCell.Mid(oCell.getString(), 1, Position - 1) 'This
>>    doesn't
>> End Sub
>>
>> The line beginning "myselection = ..." is obviously wrong. My problem is
>> I don't know how to relate "myselection" to oCell in such a way that I
>> can assign properties like fontweight etc. to it and then concatenate the
>> result with the rest of the string. myselection should be a substring of
>> oCell from position 1 up to the fullstop but I don't understand how to
>> create new objects that are substring of existing objects. Can someone
>> enlighten me?
>>   
> Have a look at the different macro's you can find under
> OpenOffice.orgMacros >> Gimmicks >> Gettexts
> 
> this must explain how to handle formating etc..
> 
> Hope it helps
> Fernand
>> Thanks in advance for the help.
>> Jonathan
>>
>>
Hi Fernand,
Thanks for the reference. I had a look but there's a huge amount of material
and I didn't really see anything relevant to the situation I described. Can
you give me a hint as to how to define a substring of an object that is
itself an object and so can be formatted like an object.

Sorry to be thick but I couldn't really see anything in GetTexts that deals
with this.

Thanks again,
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]

Reply via email to