Share via


Align Property

Sets or returns a String that represents how an object is aligned with adjacent text.

expression.align

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Remarks

When applied to an FPHTMLFieldSetElement, FPHTMLIFrame, FPHTMLImg, FPHTMLObjectElement, IHTMLElement, HTMLEmbedElement, IHTMLFieldSetElement, IHTMLIFrameElement, IHTMLImgElement, IHTMLInputImage, IHTMLObjectElement, or IHTMLSelectElement object, the align property's String value can be one of the following:

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.

When applied to an FPHTMLLegendElement, FPHTMLTableCaption, IHTMLLegendElement, or IHTMLTableCaption object, the align property's String value can be one of the following:

Value Description
bottom Aligns bottom-center.
center Aligns center.
left Aligns left.
right Aligns right.
top Aligns top-center.

When applied to an FPHTMLTable or IHTMLTable object, the align property's String value can be one of the following:

Value Description
left Aligns to the left edge.
center Aligns to the center.
right Aligns to the right edge.

When applied to an FPHTMLTableCol, IHTMLTableCol, FPHTMLDivElement, FPHTMLDivPosition, IHTMLDivElement, IHTMLDivPosition, FPHTMLHRElement, IHTMLHRElement, FPHTMLParaElement, IHTMLParaElement, FPHTMLTableCell, IHTMLTableCell, FPHTMLTableRow, or IHTMLTableRow object, the align property's String value can be one of the following:

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

Applies to | FPHTMLDivElement Object | FPHTMLDivPosition Object | FPHTMLFieldSetElement Object | FPHTMLHeaderElement Object | FPHTMLHRElement Object | FPHTMLIFrame Object | FPHTMLImg Object | FPHTMLInputImage Object | FPHTMLLegendElement Object | FPHTMLObjectElement Object | FPHTMLParaElement Object | FPHTMLSpanFlow Object | FPHTMLTable Object | FPHTMLTableCaption Object | FPHTMLTableCell Object | FPHTMLTableCol Object | FPHTMLTableRow Object | FPHTMLTableSection Object | IHTMLDivElement Object | IHTMLDivPosition Object | IHTMLFieldSetElement Object | IHTMLHeaderElement Object | IHTMLHRElement Object | IHTMLIFrameElement Object | IHTMLImgElement Object | IHTMLInputImage Object | IHTMLLegendElement Object | IHTMLObjectElement Object | IHTMLParaElement Object | IHTMLSpanFlow Object | IHTMLTable Object | IHTMLTableCaption Object | IHTMLTableCell Object | IHTMLTableCol Object | IHTMLTableRow Object | IHTMLTableSection Object