RS: NSString from RTF file
RS: NSString from RTF file
- Subject: RS: NSString from RTF file
- From: Roland Silver <email@hidden>
- Date: Mon, 4 Jun 2007 08:01:53 -0600
Can anyone suggest Cocoa code to (1) read an RTF file; (2) create an
NSString containing the contents of that file, devoid of the attributes?
For example, I have a short test file whose content, converted to a
string by initWithData:data encoding:NSISOLatin1StringEncoding, looks
like this:
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf410
{\fonttbl\f0\froman\fcharset77 TimesNewRomanMS;\f1\froman\fcharset77
TimesNewRomanItMS;}
{\colortbl;\red255\green255\blue255;\red255\green0\blue0;}
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\deftab720
\pard\pardeftab720\sa360\qj
\f0\fs37\fsmilli18667 \cf0 Arma \cf2 virumque\cf0 cano, Troiae qui
\f1\i primus
\f0\i0 ab oris\uc0\u8232 Italiam, fato profugus, Laviniaque venit
\u8232 }
So: can you suggest a code fragment to convert that (or any similar
attributed string) to the NSString
@"Arma virumque cano, Troiae qui primus ab oris
Italiam, fato profugus, Laviniaque venit"?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden