• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: RS: NSString from RTF file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RS: NSString from RTF file


  • Subject: Re: RS: NSString from RTF file
  • From: John Stiles <email@hidden>
  • Date: Mon, 04 Jun 2007 07:10:00 -0700

As was recommended earlier, you could look at TextEdit's source to see how this is done.


Roland Silver wrote:
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
_______________________________________________

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


References: 
 >RS: NSString from RTF file (From: Roland Silver <email@hidden>)

  • Prev by Date: RS: NSString from RTF file
  • Next by Date: Re: RS: NSString from RTF file
  • Previous by thread: RS: NSString from RTF file
  • Next by thread: Re: RS: NSString from RTF file
  • Index(es):
    • Date
    • Thread