OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki
OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki
OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
The Structure of Drawings 164<br />
Size.Width = 10000<br />
Size.Height = 10000<br />
Doc = StarDesktop.CurrentComponent<br />
Page = Doc.drawPages(0)<br />
RectangleShape =<br />
Doc.createInstance("com.sun.star.drawing.RectangleShape")<br />
RectangleShape.Size = Size<br />
RectangleShape.Position = Point<br />
Page.add(RectangleShape)<br />
RectangleShape.String = "This is a test"<br />
RectangleShape.CharWeight = com.sun.star.awt.FontWeight.BOLD<br />
RectangleShape.CharFontName = "Arial"<br />
This code uses the String-property of the rectangle to insert the text and the CharWeight<br />
and CharFontName properties from the<br />
com.sun.star.style.CharacterProperties<br />
service to format the text font.<br />
The text can only be inserted after the drawing object has been added to the drawing page.<br />
You can also use the<br />
com.sun.star.drawing.Text<br />
service to position and format text in drawing object. The following are some of the<br />
important properties of this service:<br />
TextAutoGrowHeight (Boolean)<br />
adapts the height of the drawing element to the text it contains<br />
TextAutoGrowWidth (Boolean)<br />
adapts the width of the drawing element to the text it contains<br />
TextHorizontalAdjust (Enum)<br />
horizontal position of text within the drawing element (default values in accordance<br />
with<br />
com.sun.star.drawing.TextHorizontalAdjust<br />
)<br />
TextVerticalAdjust (Enum)<br />
vertical position of text within the drawing element (default values in accordance with<br />
com.sun.star.drawing.TextVerticalAdjust<br />
)<br />
TextLeftDistance (Long)