---
title: "setAlignment(_:range:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextview/setalignment(_:range:)"
---

# setAlignment(_:range:)

Sets the alignment of the paragraphs containing characters in the specified range.

## Declaration

```swift
func setAlignment(_ alignment: NSTextAlignment, range: NSRange)
```

## Parameters

- `alignment`: The new alignment.
- `range`: The range of characters whose paragraphs will have their alignment set.

## Discussion

Discussion This method does not include undo support by default. Clients must invoke shouldChangeText(inRanges:replacementStrings:) or shouldChangeText(in:replacementString:) to include this method in an undoable action.

## See Also

### Related Documentation

- [rangeForUserParagraphAttributeChange](appkit/nstextview/rangeforuserparagraphattributechange.md)

### Setting text attributes

- [alignJustified(_:)](appkit/nstextview/alignjustified(_:).md)
- [changeAttributes(_:)](appkit/nstextview/changeattributes(_:).md)
- [changeColor(_:)](appkit/nstextview/changecolor(_:).md)
- [typingAttributes](appkit/nstextview/typingattributes.md)
- [useStandardKerning(_:)](appkit/nstextview/usestandardkerning(_:).md)
- [lowerBaseline(_:)](appkit/nstextview/lowerbaseline(_:).md)
- [raiseBaseline(_:)](appkit/nstextview/raisebaseline(_:).md)
- [turnOffKerning(_:)](appkit/nstextview/turnoffkerning(_:).md)
- [loosenKerning(_:)](appkit/nstextview/loosenkerning(_:).md)
- [tightenKerning(_:)](appkit/nstextview/tightenkerning(_:).md)
- [useStandardLigatures(_:)](appkit/nstextview/usestandardligatures(_:).md)
- [turnOffLigatures(_:)](appkit/nstextview/turnoffligatures(_:).md)
- [useAllLigatures(_:)](appkit/nstextview/useallligatures(_:).md)
- [toggleTraditionalCharacterShape(_:)](appkit/nstextview/toggletraditionalcharactershape(_:).md)
