Instance Method

docFormat(from:documentAttributes:)

Returns a data object that contains a Microsoft Word–format stream corresponding to the characters and attributes within the specified range.

Declaration

func docFormat(from range: NSRange, documentAttributes dict: [NSAttributedString.DocumentAttributeKey : Any] = [:]) -> Data?

Parameters

range

The range.

docAttributes

A required dictionary specifying the document attributes. The dictionary contains values from Document Types and must at least contain documentType.

Return Value

Returns a data object containing the attributed string as a Microsoft Word doc file.

Discussion

Raises an rangeException if any part of range lies beyond the end of the receiver’s characters.

See Also

Generating Data

func data(from: NSRange, documentAttributes: [NSAttributedString.DocumentAttributeKey : Any]) -> Data

Returns an data object that contains a text stream corresponding to the characters and attributes within the given range.

func fileWrapper(from: NSRange, documentAttributes: [NSAttributedString.DocumentAttributeKey : Any]) -> FileWrapper

Returns an NSFileWrapper object that contains a text stream corresponding to the characters and attributes within the given range.

func rtf(from: NSRange, documentAttributes: [NSAttributedString.DocumentAttributeKey : Any]) -> Data?

Returns an NSData object that contains an RTF stream corresponding to the characters and attributes within the given range, omitting all attachment attributes.

func rtfd(from: NSRange, documentAttributes: [NSAttributedString.DocumentAttributeKey : Any]) -> Data?

Returns a data object that contains an RTFD stream corresponding to the characters and attributes within the range.

func rtfdFileWrapper(from: NSRange, documentAttributes: [NSAttributedString.DocumentAttributeKey : Any]) -> FileWrapper?

Returns an NSFileWrapper object that contains an RTFD document corresponding to the characters and attributes within the given range.