<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSAttributedString/DocumentType",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@T@NSAttributedStringDocumentType"
  },
  "title" : "NSAttributedString.DocumentType"
}
-->

# NSAttributedString.DocumentType

Constants for the document type document attribute key.

```
struct DocumentType
```

## Overview

Use these constants as values for the [`documentType`](/documentation/Foundation/NSAttributedString/DocumentAttributeKey/documentType) key in the document attributes dictionary.

## Topics

### Getting keys for document types

[`docFormat`](/documentation/Foundation/NSAttributedString/DocumentType/docFormat)

Microsoft Word document.

[`html`](/documentation/Foundation/NSAttributedString/DocumentType/html)

Hypertext markup language (HTML) document.

[`macSimpleText`](/documentation/Foundation/NSAttributedString/DocumentType/macSimpleText)

Macintosh SimpleText document.

[`officeOpenXML`](/documentation/Foundation/NSAttributedString/DocumentType/officeOpenXML)

ECMA Office Open XML text document format.

[`openDocument`](/documentation/Foundation/NSAttributedString/DocumentType/openDocument)

OASIS Open Document text document format.

[`plain`](/documentation/Foundation/NSAttributedString/DocumentType/plain)

Plain text document.

[`rtf`](/documentation/Foundation/NSAttributedString/DocumentType/rtf)

Rich text format document.

[`rtfd`](/documentation/Foundation/NSAttributedString/DocumentType/rtfd)

Rich text format with attachments document.

[`webArchive`](/documentation/Foundation/NSAttributedString/DocumentType/webArchive)

WebKit WebArchive document.

[`wordML`](/documentation/Foundation/NSAttributedString/DocumentType/wordML)

Microsoft Word XML (WordML schema) document.

### Initializers

[`init(_:)`](/documentation/Foundation/NSAttributedString/DocumentType/init(_:))

Creates a document type.

[`init(rawValue:)`](/documentation/Foundation/NSAttributedString/DocumentType/init(rawValue:))

Creates a document type with the specified raw value.



---

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)