Skip navigation.
 
mlRe: COCOA: Simplest Way of Formatted Text
FROM : Douglas Davidson
DATE : Tue Jan 21 22:46:04 2003

On Tuesday, January 21, 2003, at 01:35  PM, Nebagakid wrote:

> What I am looking for, for example, is a way to take the entire
> contents of  an NSTextView (with different colors, fonts, even
> pictures) and be able to put that into one string with just saying "I
> want this variable to be equal to the Rich Text of this Text View"
> .... Am I talking crazy here (I am really new at Cocoa) ?


The rich text contents of the text view are held in its textStorage. 
This is an object of class NSTextStorage, which is a subclass of
NSMutableAttributedString.  You can deal with it directly, or copy it
into another attributed string.  If you wish to pass it to another
application, or store it in persistent form, you will probably want to
either archive it, or else (more commonly) store it in an external
format such as RTF or RTFD (for text with attachments).  For this
NSTextView provides methods like RTFFromRange: and RTFDFromRange:
(defined on NSText), and the AppKit's NSAttributedString.h header also
defines various methods for reading and writing RTF and RTFD.  You can
take a look at the sources to TextEdit to see some of this in action.

Douglas Davidson
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlCOCOA: Simplest Way of Formatted Text Nebagakid Jan 21, 13:46
mlRe: COCOA: Simplest Way of Formatted Text Douglas Davidson Jan 21, 19:20
mlRe: COCOA: Simplest Way of Formatted Text Nebagakid Jan 21, 22:35
mlRe: COCOA: Simplest Way of Formatted Text Douglas Davidson Jan 21, 22:46
mlRe: COCOA: Simplest Way of Formatted Text Chris Hanson Jan 21, 22:48
mlRe: COCOA: Simplest Way of Formatted Text j o a r Jan 21, 23:17
mlRe: COCOA: Simplest Way of Formatted Text Nebagakid Jan 21, 23:20
mlRe: COCOA: Simplest Way of Formatted Text Nebagakid Jan 22, 00:26
mlRe: COCOA: Simplest Way of Formatted Text Nebagakid Jan 22, 04:17
mlRe: COCOA: Simplest Way of Formatted Text j o a r Jan 22, 07:01