OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki
OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki
OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
More Than Just Text 115<br />
Frame.LeftMargin = 0<br />
Frame.RightMargin = 0<br />
Frame.BorderDistance = 0<br />
Frame.HoriOrient = com.sun.star.text.HoriOrientation.NONE<br />
Frame.VertOrient = com.sun.star.text.VertOrientation.LINE_TOP<br />
Doc.Text.insertTextContent(Cursor, Frame, False)<br />
The example creates a TextCursor as the insertion mark for the text frame. This is<br />
positioned between the first and second word of the text. The text frame is created using<br />
Doc.createInstance. The properties of the text frame objects are set to the starting values<br />
required.<br />
The interaction between the AnchorType (from the TextContent Service) and VertOrient<br />
(from the BaseFrameProperties Service) properties should be noted here. AnchorType<br />
receives the AS_CHARACTER value. The text frame is therefore inserted directly in the text<br />
flow and behaves like a character. It can, for example, be moved into the next line if a line<br />
break occurs. The LINE_TOP value of the VertOrient property ensures that the upper edge<br />
of the text frame is at the same height as the upper edge of the character.<br />
Once initialization is complete, the text frame is finally inserted in the text document using<br />
a call from insertTextContent.<br />
To edit the content of a text frame, the user uses the TextCursor, which has already been<br />
mentioned numerous times and is also available for text frames.<br />
Dim Doc As Object<br />
Dim TextTables As Object<br />
Dim Cursor As Object<br />
Dim Frame As Object<br />
Dim FrameCursor As Object<br />
Doc = StarDesktop.CurrentComponent<br />
Cursor = Doc.Text.createTextCursor()<br />
Frame = Doc.createInstance("com.sun.star.text.TextFrame")<br />
Frame.Width = 3000<br />
Frame.Height = 1000<br />
Doc.Text.insertTextContent(Cursor, Frame, False)<br />
FrameCursor = Frame.createTextCursor()<br />
FrameCursor.charWeight = com.sun.star.awt.FontWeight.BOLD<br />
FrameCursor.paraAdjust = com.sun.star.style.ParagraphAdjust.CENTER<br />
FrameCursor.String = "This is a small Test!"