There is no built-in option to set
the vertical alignment of text like there is for horizontal
alignment. However, the Vertical Movement properties can be
used to move the text up and down as needed. You just need to find
the number of lines of text and how many pixels to move.
- Place a text object on a graphics page and enter test text with
the maximum number of lines to display.
- Optionally, draw a rectangle around the text so the text is
centered in the rectangle.
- Measure the number of pixels from the top of one line of text
to the top of the next line. You can find this by using the mouse
coordinates shown in the status bar at the bottom of the window.
Enable the Cross Hair Cursor in the View menu to make this
easier.
- Open the text object's properties, Appearance (Display Value)
tab and set the type to String.
- Enter the string variable tag name to display in the String
Expression.
- Go to the Movement (Vertical) tab and set the Movement
Expression to: StrLines(TagName)
- Select Specify Range. Set Minimum to 1 and set Maximum to the
maximum number of lines of text.
- Set Offset At Minimum to 0.
- Calculate the value to enter for Offset At Maximum using:
(Maximum number of lines - 1) / 2 * Line height in pixels
For example, (4 lines of text - 1) / 2 * 16 pixels = 24
- Copy the attached Cicode file into your project. This
contains the StrLines function.
Tips:
- If the text moves left and right in the runtime instead of
up and down, make sure you entered the movement expression in the
vertical movement tab on the right side of the dialog, not
horizontal movement.
- If your text object displays several separate genie text values
separated by newline characters (e.g. %Text1%^n%Text2%^n%Text3%)
you do not need the Cicode function. Just set the movement
expression to: (StrLength("%Text1%") > 0) +
(StrLength("%Text2%") > 0) +
(StrLength("%Text3%") > 0)
|