• 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: Saving a RTFD-file with NSAttributedString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving a RTFD-file with NSAttributedString


  • Subject: Re: Saving a RTFD-file with NSAttributedString
  • From: Douglas Davidson <email@hidden>
  • Date: Mon, 4 Feb 2002 13:52:01 -0800

On Saturday, February 2, 2002, at 01:15 PM, Tae-Won Ha wrote:

NSAttributedString *attrString = [[NSAttributedString alloc]
initWithString:@""];
[[attrString RTFDFromRange:NSMakeRange(0, [attrString length])
documentAttributes:nil] writeToFile:aPath atomically:YES];

Well, this probably doesn't do what you want. The problem is that a .rtfd is not a single file; it's a package, i.e. a directory containing both rtf and attachments. For writing out to disk, you want RTFDFileWrapperFromRange:documentAttributes:, which gives you a file wrapper, which is the programmatic object that manages a package. See the TextEdit sources for an example (not really more complicated than the above). RTFDFromRange:documentAttributes: returns you the whole thing packaged up as an NSData, which is useful (for example) for writing to a pasteboard or some other serialized format, not for writing to the disk.

Douglas Davidson


References: 
 >Saving a RTFD-file with NSAttributedString (From: Tae-Won Ha <email@hidden>)

  • Prev by Date: Re: Speed of Quartz (was: optimizing compilers)
  • Next by Date: Re: Speed of Quartz (was: optimizing compilers)
  • Previous by thread: Re: Saving a RTFD-file with NSAttributedString
  • Next by thread: Proper subclassing of NSMutableArray?
  • Index(es):
    • Date
    • Thread