GetAlignment Method (ActiveX)

Returns the cell alignment for a row type.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetAlignment(rowType)
object

Type: Table, TableStyle

The objects this method applies to.

rowType

Access: Input-only

Type: AcRowType enum

The row type to get the alignment for.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow

Return Value (RetVal)

Type: AcCellAlignment enum

The alignment used for the row type.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetAlignment()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.
    
    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries
  
    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")
  
    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)
      
    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"
  
    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"
  
    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True
  
    customObj.SetAlignment AcRowType.acDataRow + AcRowType.acTitleRow, acBottomRight
    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col
      
    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetAlignment()
    ;; This example creates a TableStyle object and sets values for 
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))
    
    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")
  
    (setq customObj (vla-AddObject dictObj keyName className))
      
    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")
  
    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)
  
    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)
      
    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
	                  "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
	          )
    )
    (vlax-release-object col)  
)