expression.align
expression Required. An expression that returns one of the objects in the Applies To list.
Remarks
Value | Description |
absbottom | Positions the bottom of the object with the absolute bottom of the surrounding text. The absolute bottom is equal to the baseline of the text minus the height of the largest descender in the text. |
absmiddle | Positions the middle of the object with the absolute middle of the surrounding text. The absolute middle is the midpoint between the absolute bottom and top of the surrounding text. |
baseline | Positions the bottom of the object with the baseline of the surrounding text. |
bottom | Positions the bottom of the object with the bottom of the surrounding text. The bottom is equal to the baseline minus the standard height of a descender in the text. |
left | Positions the object to the left of the surrounding text. All preceding and subsequent text flows to the right of the object. |
middle | Positions the middle of the object in the middle of the surrounding text. The middle is the midpoint between the bottom and top of the surrounding text. |
right | Positions the object to the right of the surrounding text. All subsequent text flows to the left of the object. |
texttop | Positions the top of the object with the absolute top of the surrounding text. The absolute top is the baseline plus the height of the largest ascender in the text. |
top | Positions the top of the object with the top of the text. The top of the text is the baseline plus the standard height of an ascender in the text. |
Value | Description |
bottom | Aligns bottom-center. |
center | Aligns center. |
left | Aligns left. |
right | Aligns right. |
top | Aligns top-center. |
Value | Description |
left | Aligns to the left edge. |
center | Aligns to the center. |
right | Aligns to the right edge. |
Value | Description |
center | Aligns to the center. |
justify | Aligns to the left and right edges. |
left | Aligns to the left edge. |
right | Aligns to the right edge. |
Example
The following example aligns text around a specified image. This example takes a custom enumerated type called fpAlignType, also shown in the example below, and converts the specified constant to a String that it then uses to set the String value of the align property.
Note Custom enumerated types must be placed in the public declarations section of a code module.
Public Enum fpAlignType
fpAlignAbsBottom
fpAlignAbsMiddle
fpAlignBaseline
fpAlignBottom
fpAlignLeft
fpAlignMiddle
fpAlignRight
fpAlignTextTop
fpAlignTop
End Enum
Sub AlignImageWithText(objImg As FPHTMLImg, eWhere As fpAlignType)
Dim strAlign As String
Select Case eWhere
Case fpAlignAbsBottom
strAlign = "absbottom"
Case fpAlignAbsMiddle
strAlign = "absmiddle"
Case fpAlignBaseline
strAlign = "baseline"
Case fpAlignBottom
strAlign = "bottom"
Case fpAlignLeft
strAlign = "left"
Case fpAlignMiddle
strAlign = "middle"
Case fpAlignRight
strAlign = "right"
Case fpAlignTextTop
strAlign = "texttop"
Case fpAlignTop
strAlign = "Top"
End Select
objImg.Align = strAlign
End Sub
Use the following subroutine to call the preceding example. This subroutine assumes you have at least one IMG element in the specified document.
Sub CallAlignImageWithText()
Dim objImage As FPHTMLImg
Set objImage = ActiveDocument.all.tags("img").Item(0)
Call AlignImageWithText(objImage, fpAlignBottom)
End Sub