Re: RTF to HTML
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
References: | |
| >RTF to HTML (From: "Bas Scheffers" <email@hidden>) |