<!--
{
  "availability" : [
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSMutableAttributedString/fixParagraphStyleAttribute(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMutableAttributedString(im)fixParagraphStyleAttributeInRange:"
  },
  "title" : "fixParagraphStyleAttribute(in:)"
}
-->

# fixParagraphStyleAttribute(in:)

Fixes the paragraph style attributes in the specified range and assigns a paragraph style to all characters in the paragraph.

```
func fixParagraphStyleAttribute(in range: NSRange)
```

## Parameters

`range`

The range of characters.

## Discussion

This method assigns the first paragraph style attribute value in each paragraph to all characters of the paragraph. This method extends the range as needed to cover the last paragraph partially contained. A paragraph is delimited by any of these characters, the longest possible sequence being preferred to any shorter:

- U+000D (`\r` or CR)
- U+000A (`\n` or LF)
- U+2029 (Unicode paragraph separator)  `\r\n`, in that order (also known as CRLF)

Raises an [`rangeException`](/documentation/Foundation/NSExceptionName/rangeException) if any part of `range` lies beyond the end of the receiver’s characters.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)