Hi Nicole,

On 04/12/08 00:59, Nicole Scholz wrote:

I do the following:
1. I create a shape 2. if there is enough space left on the page then I create another shape
3. if there is not enough space left I make a page break
4. another rectangle is created

I don't know why the shapes are all created on the first page. Do I have to set the TextCursor or something that the shapes are created on the current page?

Yes, you have to use a text cursor when inserting the shape. Have a look at this basic code. It inserts four shapes on four pages:

Sub InsertShapes
xdoc = thiscomponent
cur = xdoc.gettext.createtextcursor
for i = 0 to 3
xdoc.gettext.insertcontrolcharacter(cur, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false)
  if (i > 0) then
cur.setpropertyvalue("BreakType", com.sun.star.style.BreakType.PAGE_BEFORE)
  endif
  for j = 0 to 3
eclipseShape = xdoc.createInstance("com.sun.star.drawing.EllipseShape")
    mysize = createunostruct("com.sun.star.awt.Size")
    mypos = createunostruct("com.sun.star.awt.Point")
    mysize.width = 500
    mysize.height = 500
    mypos.x = j * 300
    mypos.y = j * 500
    eclipseShape.setsize(mysize)
    eclipseShape.setposition(mypos)
    xdoc.gettext.inserttextcontent(cur.getstart(), eclipseShape, false)
eclipseShape.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH
  next j
next i
End Sub

Hope this helps.

Frank

--
Frank Meies (fme) - OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS

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

Reply via email to