LineSpacingDistance Property (ActiveX)

Specifies the spacing of multiline text.

Supported platforms: Windows only

Signature

VBA:

object.LineSpacingDistance
object

Type: GeoPositionMarker, MText

The object this property applies to.

Property Value

Read-only: No

Type: Double

The spacing of multiline text.

Remarks

MText: The value contained in this property is the Line Space Distance property in the Properties palette.

Examples

VBA:

Sub Example_LineSpacingDistance()
    ' This example creates an MText object, displays the value of the LineSpacingDistance property,
    ' changes the value of the property, and then resets the value to the original value.
    
    Dim MTextObj As AcadMText
    Dim width As Double
    Dim text As String
    Dim CurrentDistance As Double
    Dim corner(0 To 2) As Double
    corner(0) = 0
    corner(1) = 10
    corner(2) = 0
    width = 10
    text = "This is the text for the MText object"

    ' Creates the MText Object
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
    ZoomAll
    
    ' Find the current LineSpacingDistance
    CurrentDistance = MTextObj.LineSpacingDistance
    MsgBox "The LineSpacingDistance for the MText object is: " & CurrentDistance
    
    ' Change the LineSpacingDistance
    MTextObj.LineSpacingDistance = 0.7
    MsgBox "The LineSpacingDistance for the MText object is: " & MTextObj.LineSpacingDistance
    
    ' Reset the LineSpacingDistance
    MTextObj.LineSpacingDistance = CurrentDistance
    MsgBox "The LineSpacingDistance for the MText object is: " & MTextObj.LineSpacingDistance
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LineSpacingDistance()
    ;; This example creates an MText object, displays the value of the LineSpacingDistance property,
    ;; changes the value of the property, and then resets the value to the original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    (setq corner (vlax-3d-point 0 10 0)
          width 10
          text "This is the text for the MText object")
  
    ;; Creates the MText Object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MTextObj (vla-AddMText modelSpace corner width text))
    (vla-ZoomAll acadObj)
    
    ;; Find the current LineSpacingDistance
    (setq CurrentDistance (vla-get-LineSpacingDistance MTextObj))
    (alert (strcat "The LineSpacingDistance for the MText object is: " (rtos CurrentDistance 2)))
    
    ;; Change the LineSpacingDistance
    (vla-put-LineSpacingDistance MTextObj 0.7)
    (alert (strcat "The LineSpacingDistance for the MText object is: " (rtos (vla-get-LineSpacingDistance MTextObj) 2)))
    
    ;; Reset the LineSpacingDistance
    (vla-put-LineSpacingDistance MTextObj CurrentDistance)
    (alert (strcat "The LineSpacingDistance for the MText object is: " (rtos (vla-get-LineSpacingDistance MTextObj) 2)))
)