Instance Method

RTFDFromRange:documentAttributes:

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

Declaration

- (NSData *)RTFDFromRange:(NSRange)range documentAttributes:(NSDictionary<NSAttributedStringDocumentAttributeKey, id> *)dict;

Parameters

aRange

The range.

docAttributes

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

Return Value

A data object containing the RTFD stream containing the characters and attributes.

Discussion

Writes the document-level attributes in docAttributes, as explained in RTF Files and Attributed Strings.

Raises an NSRangeException if any part of aRange lies beyond the end of the receiver’s characters.

When writing data to the pasteboard, you can use the NSData object as the first argument to the NSPasteboard method setData:forType:, with a second argument of NSRTFPboardType.

See Also

Generating Data

- dataFromRange:documentAttributes:error:

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

- fileWrapperFromRange:documentAttributes:error:

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

- docFormatFromRange:documentAttributes:

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

- RTFFromRange:documentAttributes:

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

- RTFDFileWrapperFromRange:documentAttributes:

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