---
title: "init(docFormat:documentAttributes:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsattributedstring/init(docformat:documentattributes:)"
---

# init(docFormat:documentAttributes:)

Creates an attributed string from Microsoft Word format data in the specified data object.

## Declaration

```swift
init?(docFormat data: Data, documentAttributes dict: AutoreleasingUnsafeMutablePointer<NSDictionary?>?)
```

## Parameters

- `data`: The data from which to create the string.
- `dict`: An in-out dictionary containing document-level attributes. On output, this method updates the dictionary to contain any document-specific keys found in the data. Specify nil if you don’t want the document attributes.

## Return Value

Return Value Returns an initialized attributed string object, or nil if the method can’t decode the data.

## See Also

### Creating from a data file

- [init(data:options:documentAttributes:)](foundation/nsattributedstring/init(data:options:documentattributes:).md)
- [init(URL:options:documentAttributes:)](foundation/nsattributedstring/init(url:options:documentattributes:).md)
