• 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: RTF to HTML
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RTF to HTML


  • Subject: Re: RTF to HTML
  • From: Nicko van Someren <email@hidden>
  • Date: Wed, 19 Apr 2006 11:51:11 +0100

On 19 Apr 2006, at 10:52, Bas Scheffers wrote:
I have some RTF text that I need to convert. To plain text is simple; read
into NSText, get the NSString and write that to a file.


But a long time ago I recall seeing the posibility to write something like
NSTextView contentst to HTML but I can't find it now. Have I gone mad,
does this functionality exists?

I suspect that the problem is you are looking at the documentation for NSAttributedString in the Foundation documenation and the methods you are looking for are hidden in the NSAttributedString Additions category in the Application Kit. There you will find - dataFromRange:documentAttributes:error: which expects one of the items in the document attributes dictionary to be a NSDocumentTypeDocumentAttribute which you can set to NSHTMLTextDocumentType. The resulting NSData object is the HTML you're after. There is also a version that puts the data directly into an NSFileWrapper. Note that both are 10.4 specific.


	Nicko


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: RTF to HTML
      • From: Douglas Davidson <email@hidden>
References: 
 >RTF to HTML (From: "Bas Scheffers" <email@hidden>)

  • Prev by Date: Re: RTF to HTML
  • Next by Date: Re: Animated Ripple Effect
  • Previous by thread: Re: RTF to HTML
  • Next by thread: Re: RTF to HTML
  • Index(es):
    • Date
    • Thread