Hi,
Nicole Scholz wrote:
Thanks for the fast answer!
I changed the replacement statement to:
LevelFormat~xIndexAccess~xIndexReplace~replaceByIndex(1, propsToc)
but unfortunately I get this error:
method [REPLACEBYINDEX], method not found or error (exception) executing method!
Perhaps I have forgotten to link this statement to an interface, service or
something?
Please send me the full error description and the script code off-line
and I'll look at it (e.g. your "propsToc" array obviously should consist
of three elements, but you are only creating and saving one
PropertyValue, which you change three times ).
Regards,
---rony
-------- Original-Nachricht --------
Datum: Wed, 16 Jul 2008 00:48:39 +0200
Von: "Rony G. Flatscher" <[EMAIL PROTECTED]>
An: [email protected]
Betreff: Re: [api-dev] Table of Content Hyperlink problem
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