• 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
RS: NSString from RTF file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: RS: NSString from RTF file
      • From: "Finlay Dobbie" <email@hidden>
    • Re: RS: NSString from RTF file
      • From: glenn andreas <email@hidden>
    • Re: RS: NSString from RTF file
      • From: John Stiles <email@hidden>
  • Prev by Date: Core Data NSPersistentDocument and revert
  • Next by Date: Re: RS: NSString from RTF file
  • Previous by thread: Core Data NSPersistentDocument and revert
  • Next by thread: Re: RS: NSString from RTF file
  • Index(es):
    • Date
    • Thread