• 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: Douglas Davidson <email@hidden>
  • Date: Wed, 19 Apr 2006 09:34:34 -0700


On Apr 19, 2006, at 3:51 AM, Nicko van Someren wrote:

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.


There are also a number of settings that can be used to control the type of HTML that is generated, over a wide range--XHTML or HTML, strict or transitional, full document or HTML snippet, and many other possibilities. I discussed this in the AppKit release notes for 10.4; take a look at the section called "HTML Import/Export". You can also take a look at TextEdit's open/save preferences and compare with the TextEdit sources to see a few of the possibilities in use.


This functionality is available programmatically via NSAttributedString, and from the command line using textutil (see "man textutil" for more information on textutil).

Douglas Davidson

_______________________________________________
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


References: 
 >RTF to HTML (From: "Bas Scheffers" <email@hidden>)
 >Re: RTF to HTML (From: Nicko van Someren <email@hidden>)

  • Prev by Date: Re: Localization
  • Next by Date: baseline alignment of NSTextAttachment doesn't seem to always align...?
  • Previous by thread: Re: RTF to HTML
  • Next by thread: Localization
  • Index(es):
    • Date
    • Thread