Hi,
I have created a table of content. Now I would like to hyperlink the entries in the TOC. I found some examples and tried to integrate this code.
As I found in the documentation I have to create an arry with the elements 
which are included in the TOC. Here is my code:

 -- TOC
   contentInd = xDMsf~createInstance("com.sun.star.text.ContentIndex")
   contentProps = contentInd~XPropertySet

  propsToc = bsf.createArray(.UNO~PropertyValue, 1)
  propsToc[1] = .UNO~PropertyValue~new
  propsToc[1]~name="TokenType"
  propsToc[1]~value = "TokenHyperlinkStart"
  propsToc[1]~name="TokenType"
  propsToc[1]~value = "TokenText"
  propsToc[1]~name="TokenType"
  propsToc[1]~value = "TokenHyperlinkEnd"

  contentProps~setPropertyValue("CreateFromOutline",box("boolean", .true))
  contentProps~setPropertyValue("Level",box("short", 2))
  contentProps~setPropertyValue("Title","Table of Content")
  contentProps~setPropertyValue("IsProtected",box("boolean", .false))

Then I have to get the LevelFormat and replace it with my properties. But here 
I get the error that the method replaceByIndex does not exist or there is an 
exception.

  LevelFormat = contentProps~getPropertyValue("LevelFormat")
LevelFormat~xIndexAccess~xIndexReplace~replaceByIndex(box("long", 1), propsToc)
Can someone give me a hint where I have the mistake?
The replacement statement (the very last statement) should probably read:

LevelFormat~xIndexAccess~xIndexReplace~replaceByIndex(1, propsToc) [Boxing of arguments is only needed in the case of property values, if you need to use a primitive type (boolean, byte, char, short, int, long, float, double).]

HTH,

---rony



Reply via email to