Hi Marc!

Thanks for your answer. I tried to insert a paragraph break and a line break 
but the textfield is inserted right to the other one and not below. Perhaps 
there is another possibility to change the position of the textfield.

Here is my code:

/* create a RectangleShape */
Shape = xDocFactory~createInstance("com.sun.star.drawing.RectangleShape")
xShape = Shape~xShape

size = .bsf~new("com.sun.star.awt.Size", 8000 /*width*/, 5000 /*height*/)
xShape~setSize(size)

xShapeProps=xShape~xPropertySet
at_para=bsf.getConstant("com.sun.star.text.TextContentAnchorType","AT_PARAGRAPH")
xShapeProps~setPropertyValue("AnchorType", at_para)
xShapeProps~setPropertyValue("FillColor", box("int", "C0 C0 C0"x ~c2d))
 
-- create a text field at the document factory
xTextFieldProps=xDocFactory~createInstance("com.sun.star.text.TextField.URL")~XPropertySet
linebreak = "0a"x
text = "OpenOffice.org API Project"
xTextFieldProps~setPropertyValue("Representation",text  "0a0909"x)
xTextFieldProps~setPropertyValue("TargetFrame", "_blank")
xTextFieldProps~setPropertyValue("URL", "http://api.openoffice.org";)

xTextFieldProps1=xDocFactory~createInstance("com.sun.star.text.TextField.URL")~XPropertySet
xTextFieldProps1~setPropertyValue("Representation", "GMX")
xTextFieldProps1~setPropertyValue("TargetFrame", "_blank")
xTextFieldProps1~setPropertyValue("URL", "http://www.gmx.at";)


-- get the XTextContent of the shape and the field
xShapeTextContent=xShape~XTextContent
xFieldTextContent=xTextFieldProps~XTextContent
xFieldTextContent1=xTextFieldProps1~XTextContent

-- the shape is inserted at the DOCUMENT text
xDocText~insertTextContent(xDocTextCursor, xShapeTextContent, .false)

-- access the text inside the shape,
-- and create a text cursor
xShapeText       = xShape~XText
xShapeTextCursor = xShapeText~createTextCursor

call bsf.import "com.sun.star.text.ControlCharacter", "ctlChar"

-- insert the field at the SHAPE text
paraBreak=.CtlChar~paragraph_break     -- gets used multiple times in this 
routine
xShapeText~insertTextContent(xShapeTextCursor, xFieldTextContent, .false)
xShapeText~insertControlCharacter(xShapeTextCursor~getEnd, 
.CtlChar~paragraph_break, .false)
xShapeText~insertTextContent(xShapeTextCursor, xFieldTextContent1, .false)

Regards 
Nicole

-------- Original-Nachricht --------
> Datum: Fri, 05 Sep 2008 18:02:21 +0200
> Von: Marc Santhoff <[EMAIL PROTECTED]>
> An: [email protected]
> Betreff: Re: [api-dev] add more textfields to one shape

> Am Freitag, den 05.09.2008, 10:14 +0200 schrieb Nicole Scholz:
> > Hi!
> > 
> > I would like to add some textfields to one shape. But always when I
> > add them they are put directly on the right side next to the other
> > textfield. I would like to have the textfield below the textfield
> > before. 
> > 
> > Does someone have a hint how I can manage this?
> 
> I think inserting a paragraph break should suffice. Try sth. like:
> 
>    oText.insertControlCharacter(oCursor, _
>       com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, FALSE)
> 
> HTH,
> Marc
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

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

Reply via email to