Re: RTF to HTML
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