Am Mittwoch, den 18.10.2006, 09:12 +0200 schrieb Christian Andersson:
> 
> Marc Santhoff wrote:
> > Am Freitag, den 13.10.2006, 15:58 +0200 schrieb Christian Andersson:
> >> Hi there, I'm dynamicly inserting commandbuttons into a writerdocument,
> >> this is all working fine, but I have a huge problem controlling where
> >> they are located. from what I can see I can set the x and y position of
> >> the button, but I want to insert the button depending on text that I
> >> have inserted using the same macro with the anchor "as character"
> >>
> >> my pseudocode should do the following
> >>
> >> 1: get a textcursor
> >> 2: goto bookmark
> >> 3: insert new section
> >> 4: fill section with text
> >> 5: at the end of the text in the section insert an button that calls a
> >> macro when pressing it.
> >>
> >> sofar 1-4 is working great, but I have a huge problem with 5.
> >> I can insert the button, but I have no knowledge on how to move it to
> >> the "end of the section"
> >>
> >> do anyone in here have any knowledge on how to do this?
> > 
> > Have you tried getting a cursor from the text section (not the main
> > cursor from the surrounding document) and inserting the button using
> > that one (after moving to or getting the .end())?
> 
> The cursor I already got (I used it to insert the text in the section
> byt my problem is that I have not found a way to use this cursor to
> insert the commandbutton.
> 
> from what I have learned about adding buttons, etc I cannot add buttons
> to the "document" but need to add it to a drawpage and when I do that, I
> always get them at the top left corner, unless I move them with an x/y
> coordinate.

Yes, you're right. My own code works that way ... I think you have to
define the anchor of the button(s shape) form "page" to "paragraph".

smth. like:

<code>
theButton.setPropertyValue("AnchorType", _
   com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH)
</code>

If that does not do it:
How about making an additional section directly after the new one for
inserting the button there or maybe putting the button into a frame in
the section?

Marc


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to