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:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Dim iIndexLevel As Long
Dim oLevelFormat As Object
Dim arrLevelFormat
Dim i
Set oLevelFormat = oTOC.LevelFormat
For iIndexLevel = 0 To oLevelFormat.getCount() - 1
arrLevelFormat = oLevelFormat.getByIndex(iIndexLevel)
If IsArray(arrLevelFormat) And UBound(arrLevelFormat) > 0 Then
Dim iCount As Integer
iCount = UBound(arrLevelFormat)
Dim newFormat() As Variant
ReDim newFormat(iCount + 2)
Dim arrTemp(1) As Variant
Dim oProperty As Object
Set oProperty =
oSM.bridge_getstruct("com.sun.star.beans.PropertyValue")
oProperty.name = "TokenType"
oProperty.Value = "TokenHyperlinkStart"
arrTemp(0) = Array(oProperty)
newFormat(0) = arrTemp
For i = 0 To UBound(arrLevelFormat)
newFormat(i + 1) = arrLevelFormat(i)
Next
Dim arrTempNew(1) As Variant
Dim oPropertyNew As Object
Set oPropertyNew =
oSM.bridge_getstruct("com.sun.star.beans.PropertyValue")
oPropertyNew.name = "TokenType"
oPropertyNew.Value = "TokenHyperlinkStart"
arrTempNew(0) = Array(oPropertyNew)
newFormat(UBound(arrLevelFormat) + 2) = arrTempNew
Call oTOC.LevelFormat.replaceByIndex(iIndexLevel, newFormat)
End If
Next
oTOC.Update
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Can anyone please help me out? it is very urgent for me and I have tried
searching forum also but to no avail.
Plz help,
thanks & regards,
Sandeep