Hi Bernard,
Thank you for your kind response. I have tried the logic suggested by you
but still there is an automation error getting generated when I tried to
update the TOC.

Here is my modified code and the error screen shot is attached:

//////////////////////////////////////////////////////////////////////////////////////////////////
Dim iIndexLevel As Long
Dim oLevelFormat As Object
Dim arrLevelFormat
Dim i As Integer
Dim arrTemp(1) As Variant
Dim arrTempNew(1) As Variant
Dim oProperty As Object
Dim oPropertyNew As Object
Dim iCount As Integer
Dim newFormat() As Variant

Set oLevelFormat = oTOC.LevelFormat
For iIndexLevel = 0 To oLevelFormat.getCount() - 1

   arrLevelFormat = oLevelFormat.getByIndex(iIndexLevel)
   If IsArray(arrLevelFormat) And UBound(arrLevelFormat) > 0 Then
       iCount = UBound(arrLevelFormat)
       ReDim newFormat(iCount + 2) As Variant

       Set oProperty =
oSM.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
       oProperty.name = "TokenType"
       oProperty.Value = "TokenHyperlinkStart"
       Set arrTemp(0) = oProperty
       newFormat(0) = arrTemp


       For i = 0 To UBound(arrLevelFormat)
           newFormat(i + 1) = arrLevelFormat(i)
       Next


       Set oPropertyNew =
oSM.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
       oPropertyNew.name = "TokenType"
       oPropertyNew.Value = "TokenHyperlinkEnd"
       Set arrTempNew(0) = oPropertyNew
       newFormat(UBound(arrLevelFormat) + 2) = arrTempNew

       Dim unoWrap As Variant
       Set unoWrap = oSM.Bridge_GetValueObject
       unoWrap.Set "[]com.sun.star.beans.PropertyValue", newFormat
       *Call oTOC.LevelFormat.replaceByIndex(iIndexLevel, unoWrap)   '  Here
is the error
*
   End If

Next

oTOC.Update

/////////////////////////////////////////////////////////////////////////////////////////////////////////

May be I am doing something really stupid here....PLEASE HELP.

thanks & regards,
Sandeep



On 9/20/07, Bernard Marcelly <[EMAIL PROTECTED]> wrote:
>
> Message de Sandeep Raghuvanshi  date 2007-09-20 16:58 :
> > Hi,
> > I am trying to implement the hyperlink functionality for table of
> content
> > using Visual Basic 6.0 and though the documentation says that we have to
> > pass first parameter as Long and Second one as Any/Variant, the
> > replaceByIndex is always throwing IllegalArgumentException.
> >
> > Here is the code:
> >
> ( ... )
>
> >
> >        Call oTOC.LevelFormat.replaceByIndex(iIndexLevel, newFormat)
> >
>
> I already have answered a similar question in
> <http://www.oooforum.org/forum/viewtopic.phtml?p=239563#239563>
>
> Answer adapted to your case:
>
> You have to pass an array of Uno objects, and the argument of
> replaceByIndex is defined as : any
> So you have to tell the bridge what exactly you are passing.
> This is a limitation of the COM bridge, whatever the language you use.
>
> Solution:
> Dim unoWrap As Variant
> Set unoWrap = oSM.Bridge_GetValueObject
> unoWrap.set "[]com.sun.star.beans.PropertyValue", newFormat
> Call oTOC.LevelFormat.replaceByIndex(iIndexLevel, unoWrap)
>
>
> Concerning OOo general programming through VB6 you may be interested in
> the libraries provided by VBx_OOo tool :
> <http://www.ooomacros.org/dev.php#240562>
>
> ______
> Bernard
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to