Hallo Jochen,

noch eine weitere Quelle aus dem StarOffice Programmer's Tutorial von 2000, 
leider jetzt natürlich reichlich unformatiert. Außerdem habe ich hier noch als 
*.pdf das Programmierhandbuch von 2005 in Deutsch. Da ist auch (etwas besser 
dargestellt) die Erstellung von Textrahmen erklärt. Der Link dazu:
http://dlc.sun.com/pdf/819-1326/819-1326.pdf

Inserting a frame
Frames can serve several purposes. You can use them to display graphics in a 
text document, to attach an icon to a certain word, and frames can be used to 
implement columns, because you can link them together. If the text overflows 
the first frame, it is automatically continued in the second one. We’ll first 
show you how to create a simple frame that contains text:

Dim oFrame As Object
oCursor = oText.createTextCursor()
oText.insertString(oCursor,_
"First paragraph", FALSE)
oText.insertControlCharacter(oCursor,_
com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, _
FALSE)
oText.insertString(oCursor,_
"Second paragraph" , FALSE)
oCursor.gotoStart(FALSE)
oCursor.gotoNextWord(FALSE)
oFrame = oDocument.createInstance(_
"com.sun.star.text.TextFrame")
Dim aSize As New com.sun.star.awt.Size
aSize.width = 2000
aSize.height = 1000
oFrame.Size = aSize
oFrame.AnchorType = _
com.sun.star.text.TextContentAnchorType.AS_CHARACTER
oFrame.TopMargin = 0
oFrame.BottomMargin = 0
oFrame.LeftMargin = 0
oFrame.RightMargin = 0
oFrame.BorderDistance = 0
oFrame.HoriOrient = _
com.sun.star.text.HoriOrientation.NONE
oFrame.VertOrient = _
com.sun.star.text.VertOrientation.LINE_TOP
oText.insertTextContent(oCursor, oFrame, FALSE)

Here we begin with two simple text paragraphs and position the text cursor at 
the beginning of the first paragraph. Then the frame is created and some 
properties are set to reasonable values. In particular, the anchorType is 
specified as AS_CHARACTER, meaning that the frame is treated as if it were a 
character. Consequently, the line spacing is adjusted if the frame grows 
vertically. Another anchorType value is AT_CHARACTER, which simply anchors the 
frame at a specific character. The other properties ensure that the new frame 
is properly placed with respect to the text line.

oCursor = oFrame.createTextCursor
oCursor.charWeight = com.sun.star.awt.FontWeight.BOLD
oCursor.paraAdjust = com.sun.star.style.ParagraphAdjust.CENTER
oFrame.insertString(oCursor, "New", TRUE)

These four lines insert the centered word New in bold characters into the 
frame. The important thing here is to create a text cursor at the frame and to 
use the insertString( ) method of the frame as well.

Gruß

Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@de.openoffice.org
For additional commands, e-mail: users-h...@de.openoffice.org

Antwort per Email an